FreeDOS help system (hhstndrd 1.0.8 en)[choice]

Command: choice, _choice

CHOICE / _CHOICE suspends processing and waits for the user to press a valid key from a given list of choices. Choice gives out an ERRORLEVEL which can be used for further work.

Syntax:

CHOICE [ /B ] [ /C[:]choices ] [ /N ] [ /S ] [ /T[:]c,nn ] [ text ] [/?] _CHOICE [ /B ] [ /C[:]choices ] [ /N ] [ /S ] [ /T[:]c,nn ] [ text ] [/?]

Options:

/B Sound an alert (beep) at prompt. /C[:] choices - Specifies allowable keys. Default is: yn (if /C was not used), you may also be 0 - 9 or A - Z. /N Do not display the choices and ? at end of prompt. /S Treat choices as case-sensitive. /T[:]c,nn Automatically choose key c after nn seconds. c must be one of the keys specified with /C; nn may be a value between 0 and 99. text The text to display as a prompt (default=none). /? Shows the help.

Comments:

CHOICE shows the messages according to the file: %NLSPATH%\CHOICE.%LANG%, where LANG is SET in the environment variable in AUTOEXEC.BAT and NLSPATH is the path to the national language files. _CHOICE uses english texts only. CHOICE is not a command internal to command.com and needs a choice file in order to work. CHOICE supports NLS (national language support). CHOICE has the following EXITCODES (ERRORLEVEL): 0 if aborted ... ERRORLEVEL is set to offset of key user presses in choices. 255 any error

Examples:

IN A BATCH FILE: @ECHO 1 = Do this @ECHO 2 = Do that @ECHO 3 = Do another thing @ECHO 4 = Do nothing @choice /B /C:1234 /N /S What do you want to do? if errorlevel 4 goto DONOTHING if errorlevel 3 goto DOANOTHER if errorlevel 2 goto DOTHAT if errorlevel 1 goto DOTHIS :DOTHIS your DOTHIS-commands goto EXIT :DOTHAT your DOTHAT-commands goto EXIT :DOANOTHER your DOANOTHER-commands goto EXIT :DONOTHING your DONOTHING-commands goto EXIT :EXIT

See also:

autoexec.bat batch files if goto pause set ------------------------------------------------------------------------------ Copyright (C) 1994-2003 Jim Hall, updated 2008 by W. Spiegl. This file is derived from the FreeDOS Spec Command HOWTO. See the file H2Cpying for copying conditions.