help.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CHOICE
Note  Examples
────────────────────────────────────────────────────────────────────────────
 
                                   CHOICE
 
Prompts the user to make a choice in a batch program. Displays a specified
prompt and pauses for the user to choose from among a specified set of keys.
You can use this command only in batch programs.
 
For more information on the ERRORLEVEL parameter, see <CHOICE──Note> and the
<IF> command.
 
Syntax
 
    CHOICE [/C[:]keys] [/N] [/S] [/T[:]c,nn] [text]
 
Parameters
 
text
    Specifies text you want to be displayed before the prompt. Quotation
    marks are necessary only if you include a switch character (/) as part
    of the text before the prompt. If you don't specify text, CHOICE
    displays only a prompt.
 
Switches
 
/C[:]keys
    Specifies allowable keys in the prompt. When displayed, the keys will be
    separated by commas, will appear in brackets ([]), and will be followed
    by a question mark. If you don't specify the /C switch, CHOICE uses YN
    as the default. The colon (:) is optional.
 
/N
    Causes CHOICE not to display the prompt. The text before the prompt is
    still displayed, however. If you specify the /N switch, the specified
    keys are still valid.
 
/S
    Causes CHOICE to be case sensitive. If the /S switch is not specified,
    CHOICE will accept either upper or lower case for any of the keys that
    the user specifies.
 
/T[:]c,nn
    Causes CHOICE to pause for a specified number of seconds before
    defaulting to a specified key. The values for the /T switch are as
    follows:
 
    c
        Specifies the character to default to after nn seconds. The
        character must be in the set of choices specified in the /C switch.
 
    nn
        Specifies the number of seconds to pause. Acceptable values are from
        0 to 99. If 0 is specified, there will be no pause before
        defaulting.
 
                                      ♦