Is there a DOS command that does this?
Is there a DOS command that writes a list of options, so the user chooses one and one of a number of command lines executes?
A .bat file with this would be easier than a readme telling you which command line to use and use less space than a simple .exe.
This should do what you need:
ECHO 1. MS-DOS Editor.
ECHO 2. MS-Windows. (default)
ECHO 3. Defrag the hard-drive.
ECHO 4. Quit.
CHOICE /C:1234 /N /T:2,5 Please choose a menu option.
IF ERRORLEVEL == 4 GOTO QUIT_MENU
IF ERRORLEVEL == 3 GOTO DEFRAG_HD
IF ERRORLEVEL == 2 GOTO RUN_WIN
IF ERRORLEVEL == 1 GOTO RUN_EDIT
:RUN_EDIT
CALL EDIT
:RUN_WIN
CALL WIN
:DEFRAG_HD
DEFRAG c:
:QUIT_MENU
ECHO Safe to switch off machine now...
Tell me if you still don''t understand how it works
-Zredna
ECHO 1. MS-DOS Editor.
ECHO 2. MS-Windows. (default)
ECHO 3. Defrag the hard-drive.
ECHO 4. Quit.
CHOICE /C:1234 /N /T:2,5 Please choose a menu option.
IF ERRORLEVEL == 4 GOTO QUIT_MENU
IF ERRORLEVEL == 3 GOTO DEFRAG_HD
IF ERRORLEVEL == 2 GOTO RUN_WIN
IF ERRORLEVEL == 1 GOTO RUN_EDIT
:RUN_EDIT
CALL EDIT
:RUN_WIN
CALL WIN
:DEFRAG_HD
DEFRAG c:
:QUIT_MENU
ECHO Safe to switch off machine now...
Tell me if you still don''t understand how it works
-Zredna
ohhhhhhhhh ohhhhhwwwww good old days dos stuff
choice and errorlevel combination!
Arkon
[QSoft Systems]
choice and errorlevel combination!
Arkon
[QSoft Systems]
Zredna''s example is missing a few things... here''s a fixed version.
@ECHO off
:SHOW_MENU
ECHO 1. MS-DOS Editor.
ECHO 2. MS-Windows. (default)
ECHO 3. Defrag the hard-drive.
ECHO 4. Quit.
CHOICE /C:1234 /N /T:2,5 Please choose a menu option.
IF ERRORLEVEL == 4 GOTO QUIT_MENU
IF ERRORLEVEL == 3 GOTO DEFRAG_HD
IF ERRORLEVEL == 2 GOTO RUN_WIN
IF ERRORLEVEL == 1 GOTO RUN_EDIT
:RUN_EDIT
EDIT
GOTO SHOW_MENU
:RUN_WIN
WIN
GOTO SHOW_MENU
:DEFRAG_HD
DEFRAG c:
GOTO SHOW_MENU
:QUIT_MENU
@ECHO off
:SHOW_MENU
ECHO 1. MS-DOS Editor.
ECHO 2. MS-Windows. (default)
ECHO 3. Defrag the hard-drive.
ECHO 4. Quit.
CHOICE /C:1234 /N /T:2,5 Please choose a menu option.
IF ERRORLEVEL == 4 GOTO QUIT_MENU
IF ERRORLEVEL == 3 GOTO DEFRAG_HD
IF ERRORLEVEL == 2 GOTO RUN_WIN
IF ERRORLEVEL == 1 GOTO RUN_EDIT
:RUN_EDIT
EDIT
GOTO SHOW_MENU
:RUN_WIN
WIN
GOTO SHOW_MENU
:DEFRAG_HD
DEFRAG c:
GOTO SHOW_MENU
:QUIT_MENU
Damn, well anyway it wasn''t my own example I found it at an batch-programming site.
Zredna
Zredna
BTW, there is no "CHOICE" command in Windows 2000, as far as I can tell. I know some batch files have done interesting kludges like create files called 1.BAT, 2.BAT, 3.BAT, 4.BAT etc. The contents of these batch files execute the various menu commands. The main batch file simply displays the menu and exists.
"All you need to do to learn circular logic is learn circular logic"
"All you need to do to learn circular logic is learn circular logic"
"All you need to do to learn circular logic is learn circular logic"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement