VOGONS

Common searches


First post, by Terrapin

User metadata
Rank Newbie
Rank
Newbie

Hey there Vogonites!

I'm having a bit of trouble here. I'm attempting to create a potentially 'universal' file/folder structure for running DOS games via DOSbox. Have to give credit to 3D Realms for helping me figure a lot of this out using examples of their .bat and .conf files they use in the 3D Realms Anthology.

So, I'm working with Commander Keen - Goodbye Galaxy .conf. I've added entries for the user-created games: Keen7, Keen8, Keen9, and Keen10. Unfortunately, they run using their own .BAT files. When these files are run through the .BAT file used to run each game using a sort of GUI created in the .conf file under the Autoexec entry, DOSbox seems to ignore the 'exit' (and 'cls') command. I'll give examples of the batch and conf files I'm using to clear up any confusion...

The file/folder structure looks like this:

.\3D Realms Anthology\
-Commander Keen - Galaxy folder
-Commander Keen - Galaxy.BAT

Commander Keen - Galaxy\
-Keen7 folder
-Keen8 folder
-Keen9 folder
-Keen10 folder
-Keen4 files
-Keen5 files
-Keen6 files
-Keen Galaxy.conf
-joystick mapper file.map

Inside each Keen folder (for 7, 8, 9, and 10) there is a KeenX.bat file that applies a patch to the game and then calls the executable to make it run. The games do run, but upon exiting the game, it is left at the DOS prompt and does not exit on it's own with the provided 'exit' command which works for Keen4, 5 and 6 because DOSbox is calling to run their EXE files.

Here is the autoexec info located in the "Keen Galaxy.conf"
I removed the brackets around autoexec to avoid any problems with forum coding.

  • autoexec
    # Lines in this section will be run at startup.
    # You can put your MOUNT lines here.

    @echo off
    Mount C ".."
    C:
    cls

    echo.
    echo [29;1m Commander Keen in: Goodbye Galaxy!
    echo [30;1m by Apogee
    echo.
    echo [32;1m 1. Part 4 - Secret of the Oracle
    echo [36;1m 2. Part 5 - The Armageddon Machine
    echo [31;1m 3. Part 6 - Aliens Ate My Babysitter
    echo [35;1m 4. Part 7 - The Keys of Krodacia
    echo [33;1m 5. Part 8 - Dead In the Desert
    echo [34;1m 6. Part 9 - Battle of the Brains
    echo [38;1m 7. Part 10 - Mirror Menace
    echo [37;1m 8. Exit
    echo.
    echo [30;1m NOTE: To switch between windowed and full-screen press ALT+ENTER
    echo [0m
    choice /c12345678 /s Choose your episode: /n
    echo.

    if errorlevel == 8 goto exit

    if errorlevel == 7 goto e7
    if errorlevel == 6 goto e6
    if errorlevel == 5 goto e5
    if errorlevel == 4 goto e4
    if errorlevel == 3 goto e3
    if errorlevel == 2 goto e2
    if errorlevel == 1 goto e1
    :e1
    KEEN4E.exe
    exit

    :e2
    KEEN5E.exe
    exit

    :e3
    cd Keen6
    Keen6.exe
    exit

    :e4
    cd Keen7
    Keen7.bat -noconsole -exit
    exit

    :e5
    cd Keen8
    Keen8.bat
    cls
    exit

    :e6
    cd Keen9
    Keen9.bat
    cls
    exit

    :e7
    cd Keen10
    Keen10.bat
    cls
    exit

    :exit
    exit

I added the cls command because I had read that sometimes you don't even need the 'exit' command; 'cls' will prompt DOSbox to exit for some reason or other.
EDIT: I also added the '-noconsole -exit' commands to the end of Keen7.bat as seen above and DOSbox ignored that. Upon ending the game, I was still stuck at the cmd prompt with an image left over from the game exiting.

Here is an example of Keen7.bat

  • ck4patch KEEN7.PAT

[/list]

It calls ck4patch.exe and then tells it the patch to apply is named 'KEEN7.PAT'
I assume the exe file then calls upon Keen4.exe? Because the game does run.

I've also read that applying the '-noconsole -exit' commands help batch files to exit, but I'm not sure where to apply the commands. I've tried placing them at the end of what's contained in Keen7.bat, but that did not work.

Any help would be highly appreciated and would be a nice reference for others looking for this information.
Thanks!!

Reply 2 of 3, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You have to CALL subordinate batch files if they need to return to the batch file that ran them (e.g. "call Keen7.bat").

BTW, don't use batch labels that are DOS commands, such as the :exit label in your example.

Reply 3 of 3, by Terrapin

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote:

You have to CALL subordinate batch files if they need to return to the batch file that ran them (e.g. "call Keen7.bat").

BTW, don't use batch labels that are DOS commands, such as the :exit label in your example.

Thanks for the info. I'm still learning my way about basic commands, batch files, etc.

So, if I use "call Keen7.bat" then it will revert to the batch orders once the program exits, therefore returning to utilize the "exit" command?

The last entry, ":exit" works. That's called upon in the initial GUI as one of the choices.
When running Commander Keen - Galaxy.bat, I'm greeted with a GUI with numerical choices of which game I want to run.
(I've turned all these batch files that run the games into .exe's with custom icons. 😀

EDIT: Wow!! It works! I could just about hug you right now. Thanks!!