VOGONS


First post, by Wolfdude

User metadata
Rank Newbie
Rank
Newbie

I am trying to create a batch file that will give me a list of games, and then i could execute one of them by typing the number associated with that game.

It works with the command prompt but i am having problems with dosbox. In dosbox once i execute the batch file I cannot type a number into the answer line. (I attach images)

Title = "Game List"
@Echo off
CLS
mode con: cols=40 lines=15
:MENU
cls
Echo Choose a game from the list:
Echo.
Echo [1] Comanche
Echo [20] Duke 3D
Echo.
set /P menu=:
if '%menu%'=='1' "D:\\dosgames\COMANCHE\COMANCHE.exe"
if '%menu%'=='20' "D:\\dosgames\Duke3D\Duke3D.exe"

CMD.jpg
Command Prompt
DOSBOX.jpg
DosBox

Any help would be welcome. (P.S. I'm a noob at programming.)

Thanks for reading my thread.

Reply 2 of 6, by Wolfdude

User metadata
Rank Newbie
Rank
Newbie

I didn't know that command was only for command prompt.
I did a little research on that command that you told me and I almost got it.

Now I am having trouble loading the second choice. So, when I type "1" Comanche:Maximum Overkill comes up, and when I type "2" Duke Nukem 3D should come up, but instead Comanche:Maximum Overkill comes up.......

Title = "Game List"
@Echo off
CLS
mode con: cols=40 lines=15
:MENU
cls
Echo Choose a game from the list:
Echo.
Echo [1] Comanche
Echo [2] Duke 3D
Echo.
CHOICE /C:12 /N Pick A Game:
IF ERRORLEVEL == 1 GOTO COMANCHE
IF ERRORLEVEL == 2 GOTO DUKE3D
:COMANCHE
cd C:\\COMANCHE\
comanche
:DUKE3D
cd C:\\DUKE3D\
duke3d

1-1.jpg2.jpg

Thanks Ripsaw for the reply.

Reply 3 of 6, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Your approach to ERRORLEVEL is not correct. You don't need to use equal signs, and test the error level in descending order because lower levels are true compared to higher ones.

IF ERRORLEVEL 2 GOTO DUKE3D 
IF ERRORLEVEL 1 GOTO COMANCHE

Search for examples of how to use CHOICE and ERRORLEVEL, there should be plenty available on the net.

Reply 4 of 6, by Wolfdude

User metadata
Rank Newbie
Rank
Newbie

🤣, thank you. I did find an example (http://www.techiwarehouse.com/engine/e1241093 … h-File-Commands), but the noob I am didn't think I had to list the IF commands from higher to lower.

Thank you.

DOSBOX RULES !

Reply 5 of 6, by cfoesch

User metadata
Rank Newbie
Rank
Newbie

the noob I am didn't think I had to list the IF commands from higher to lower.

Don't even apologize for this... DOS Batch files work so weird... if you test an errorlevel in an IF it actually measures if it is at least that value... makes programming for it a pain in the butt.