VOGONS

Common searches


First post, by Annorax

User metadata
Rank Newbie
Rank
Newbie

I've been playing around with writing a batch script to be a launcher for my games. It looks something like this:

@echo off
echo ###########
echo Choose Game
echo ###########
echo 1.) Ultima Underworld
echo 2.) Ultima Underworld 2
echo 3.) Ultima 6
echo 4.) Quit

choice /n /c:1234
if errorlevel 4 GOTO:EOF
if not errorlevel 4 if errorlevel 3 cd C:\Ultima\ultima6 & ultima6.exe
if not errorlevel 3 if errorlevel 2 C:\Ultima\uw2\uw2.exe
if not errorlevel 2 if errorlevel 1 cd C:\Ultima\uw & uw.exe

It does not work fully as intended and I think the reasons are real DOS vs DOSBox differences. Are there any workarounds or plans to implement the following?

1.) "GOTO:EOF" - this gives illegal command error but is valid in real DOS. This is helpful in batch scripts to quit the script without "exit", which closes the DOS window.
2.) Running multiple commands on one line with &, &&, |, ||, etc... does not seem to work as intended.
3.) "doskey" would be nice to have but it also gives illegal command errors.
4.) Batch files typically can have the file extension .BAT or .CMD. In DOSBox, only .BAT seems to work, not .CMD, even though the files are identical. Not a major problem as we can just use .BAT, but a difference nonetheless.

Knowledge is power. Power corrupts. Study hard. Become evil.

Reply 1 of 2, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You are pointing out features of the Windows command shell, not real DOS. In any case, DOSBox's built-in command shell only supports features of MS-DOS 5 and 6, and a subset at that.

Reply 2 of 2, by Quadko

User metadata
Rank Newbie
Rank
Newbie

But, good news is that minor tweaks should get what you want working in DOSBox, no problem:

GOTO:EOF becomes GOTO EOF, and you put an :EOF tag at the end of your file (it's not a special name).
Instead of putting everything on one line, you make little blocks for them, here's a sample:

choice /n /c:1234
IF ERRORLEVEL 4 GOTO EOF
IF ERRORLEVEL 3 GOTO ULTIMA6
IF ERRORLEVEL 2 GOTO UW2
IF ERRORLEVEL 1 GOTO UW1
GOTO EOF

:ULTIMA6
cd C:\Ultima\ultima6
ultima6.exe
GOTO EOF

:UW2
C:\Ultima\uw2\uw2.exe
GOTO EOF

... put more blocks here ...

:EOF

You can drop the "if not 4 if 3 Goto" pattern, you don't need it anymore.

If you want an example of really well done ones with ascii/ansi art, check these out: http://www.classicdosgames.com/forum/viewtopi … .php?f=2&t=1292
After seeing those I made some of my own hacking around with PabloDraw and a text editor.