VOGONS


First post, by Vresiberba

User metadata
Rank Newbie
Rank
Newbie

My google-fu is over, I just want a simple .bat script that I start from within a folder that gives you the option of 1, 2 and so on to start an application and Q to abort the menu. I have googled for an hour, drank a few beers and now I'm irritated!

Reply 1 of 2, by jakethompson1

User metadata
Rank Oldbie
Rank
Oldbie
@echo off
echo 1. Commander Keen
echo 2. Doom
echo Q. Quit
choice /C:12Q Which one?
if errorlevel 3 goto q
if errorlevel 2 goto 2
if errorlevel 1 goto 1
goto q
:1
keen1
goto q
:2
doom
goto q
:q

Careful with if errorlevel. It matches that errorlevel or anything higher. So the if errorlevels to check which option they entered, must go in descending order.

Reply 2 of 2, by Vresiberba

User metadata
Rank Newbie
Rank
Newbie

Got it. Thank you, I got tangled up in order. This was perfect!