VOGONS

Common searches


Storing the result of CHOICE to a text file?

Topic actions

  • This topic is locked. You cannot reply or edit posts.

First post, by chinagreenelvis

User metadata
Rank Newbie
Rank
Newbie

I'm trying to modify the run.bat files of REMOVED so that I can set a default option for games that use it (usually which version of the game to run or sound profile). I figured the simplest way would be to stick the value of ERRORLEVEL resulting from CHOICE into a text file and then reading that file if it exists instead.

The only problem is that from within DOSBox, there doesn't seem to be a way to do this. I can output to a text file, obviously, but dealing with ERRORLEVEL as a variable is frustrating.

Any help is appreciated.

Last edited by DosFreak on 2023-10-14, 19:29. Edited 1 time in total.

Reply 1 of 2, by chinagreenelvis

User metadata
Rank Newbie
Rank
Newbie

Here is what a typical run.bat looks like:

:menu
@echo off
cls
echo.
echo Press 1 for Space Quest V: The Next Mutation w/ SoundBlaster
echo Press 2 for Space Quest V: The Next Mutation w/ MT32
echo Press 3 for Space Quest V: The Next Mutation w/ Sound Canvas
echo Press 4 to Quit
echo.
choice /C:1234 /N Please Choose:

if errorlevel = 4 goto quit
if errorlevel = 3 goto SC55
if errorlevel = 2 goto MT32
if errorlevel = 1 goto SB16

:SB16
CONFIG -set "mididevice=default"
del RESOURCE.CFG
copy .\sb16\*.*
cls
@SIERRA
goto quit
cls

:MT32
CONFIG -set "mididevice=mt32"
del RESOURCE.CFG
copy .\mt32\*.*
cls
@SIERRA
goto quit
cls

:SC55
CONFIG -set "mididevice=fluidsynth"
del RESOURCE.CFG
copy .\sc55\*.*
cls
@SIERRA
goto quit
cls

:quit
exit