Sam Posted August 17, 2004 Share Posted August 17, 2004 Can i make like a menu systen in a batfile like PaintWordpad Notepad and if i press enter on one it goes to the relevant file. If i can, how? thanks. Link to comment Share on other sites More sharing options...
0 PsyCX Posted August 17, 2004 Share Posted August 17, 2004 --- @echo off echo 1) Paint echo 2) Wordpad echo 3) Notepad echo. choice /c:123 if errorlevel 3 start notepad.exe if errorlevel 2 start wordpad.exe if errorlevel 1 start mspaint.exe --- However, this won't work as XP doesn't include the choice.exe that was in DOS >6 and onwards. You can find it on a Windows 9x box though. -psycx Link to comment Share on other sites More sharing options...
0 Sam Posted August 17, 2004 Author Share Posted August 17, 2004 would it work if i entered dos via a win 98 boot disk? Link to comment Share on other sites More sharing options...
0 kjordan2001 Posted August 17, 2004 Share Posted August 17, 2004 would it work if i entered dos via a win 98 boot disk? Well, these are obviously not DOS programs you want to run. You can use SET /P to get user input in 2000 and XP. @ECHO OFF CLS :LOOP ECHO A. Menu item A ECHO B. Menu item B ECHO C. Menu item C ECHO Q. Quit :: SET /P prompts for input and sets the variable :: to whatever the user types SET Choice= SET /P Choice=Type the letter and press Enter: :: The syntax in the next line extracts the substring :: starting at 0 (the beginning) and 1 character long IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1% ECHO. :: /I makes the IF comparison case-insensitive IF /I '%Choice%'=='A' GOTO ItemA IF /I '%Choice%'=='B' GOTO ItemB IF /I '%Choice%'=='C' GOTO ItemC IF /I '%Choice%'=='Q' GOTO End ECHO "%Choice%" is not valid. Please try again. ECHO. GOTO Loop :ItemA ECHO Insert commands for Item A. GOTO Again :ItemB ECHO Insert commands for Item B. GOTO Again :ItemC ECHO Insert commands for Item C. GOTO Again :Again PAUSE CLS GOTO Loop :End Taken from: http://www.pcmag.com/article2/0,4149,763154,00.asp Link to comment Share on other sites More sharing options...
Question
Sam
Can i make like a menu systen in a batfile like
and if i press enter on one it goes to the relevant file. If i can, how?
thanks.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts