Using Choice to get user interaction

MS DOS 6.0 introduced the program CHOICE, which can display a set of options and wait for the user to make a choice. When the user makes a selection the return code of CHOICE contains the selection, which can be accessed using ERRORLEVEL. This makes it possible to prompt the user for input from the command line in a batch file and react to it.

choice /c:abc Choose an option
IF ERRORLEVEL 3 GOTO OPTIONC
IF ERRORLEVEL 2 GOTO OPTIONB
IF ERRORLEVEL 1 GOTO OPTIONA

:OPTIONC
ECHO C
GOTO EXIT

:OPTIONB
ECHO B
GOTO EXIT

:OPTIONA
ECHO A
GOTO EXIT

:EXIT

More Info MS KB77457
More Info MS KB96697
More Info MS KB97504