
views
Click Start>Run
Type "cmd" (no quotations)
Type "edit"
Type the following, careless of bolded/unbolded worlds. After each press enter. Anything in parenthesis do NOT type, these are side-notes that tries to explain the steps.
@echo off (This command will 'hide' the command input - optional but recommended)
cls (This will clear anything above - optional but recommended if you're wanting to make it look neat) startCreate Options or Choices in a Batch File Step 7 Version 2.jpg
echo.
echo Choice 1 ("Choice 1" can be renamed to whatever you want, any of the choices)
echo Choice 2
echo Choice 3 (Keep doing that until you have all of the choices that you need.)
Type "set /p choice=(Insert question or command here, like "Yes or no?")
if not '%choice%'== set choice=%choice:~0,1%
if '%choice%'=='1' goto :choice1
if '%choice%'=='2' goto :choice2
(Continue doing this pattern until you have enough. Then type:)
echo "%choice%" is not a valid option. Please try again.
echo.
goto start
After that you type: choice1Create Options or Choices in a Batch File Step 21 Version 2.jpg
(commands you want to run)
goto end choice2Create Options or Choices in a Batch File Step 24 Version 2.jpg
(commands)
goto end choice3Create Options or Choices in a Batch File Step 27 Version 2.jpg
(commands)
goto end
Continue doing this pattern until you have completed the file. endCreate Options or Choices in a Batch File Step 31 Version 2.jpg
pause
exit
Save this as a .bat file. Double click to test your batch file.
Comments
0 comment