Example: Decisions in MS-DOS
The following program presents the user with a menu, then prompts them for user input which is stored in a variable named choice, then performs several IF statements to direct the program to statements related to each menu option. cls is the DOS command to clear the screen.
@echo off
echo Main Menu
echo ---------
echo 1. Run Program #1
echo 2. Run Program #2
echo 3. Run Program #3
echo 4. Exit
set /p choice=Please enter menu choice:
if "%choice%" == "1" goto :program1
if "%choice%" == "2" goto :program2
if "%choice%" == "3" goto :program3
:program1
cls
echo Program #1
goto :end
:end
:program2
cls
echo Program #2
goto :end
:program3
cls
echo Program #3
goto :end
:end