Version of CHOICE extracted from Win2003: 5.2.3790.0
CHOICE
Description:
This tool allows the user to select an item from a list of choices and returns the index of the selected item.
Parameter list:
/C choices Specifies the list of options to create. The default list is "YN".
/N Hides the option list in the prompt. The message preceding the prompt is displayed, and the options remain enabled.
/CS Allows case-sensitive options to be selected. By default, this tool is case-insensitive.
/T timeout The number of seconds to pause before making a default selection. Acceptable values are from 0 to 9999. If 0 is specified, there will be no pause, and the default option will be selected.
/D choice Specifies the default option after nnnn seconds. The character must be in the set of choices specified with /C; also, /T must be used to specify nnnn.
/M text Specifies the message to display before the prompt. If not specified, the tool only displays the prompt.
/? Displays help message.
Note:
The ERRORLEVEL environment variable is set to the key index selected from the choice set. The first choice listed returns 1, the second choice returns 2, and so on. If the key pressed by the user is not a valid choice, the tool beeps. If the tool detects an error condition, it returns an ERRORLEVEL value of 255. If the user presses Ctrl+Break or Ctrl+C, the tool returns an ERRORLEVEL value of 0. When using the ERRORLEVEL parameter in a batch program, order the parameters in descending order.
Examples:
CHOICE /?
CHOICE /C YNC /M "Press Y to confirm, N to reject, or C to cancel."
CHOICE /T 10 /C ync /CS /D y
CHOICE /C ab /M "Select a for option 1, b for option 2."
CHOICE /C ab /N /M "Select a for option 1, b for option 2."
CHOICE
Description:
This tool allows the user to select an item from a list of choices and returns the index of the selected item.
Parameter list:
/C choices Specifies the list of options to create. The default list is "YN".
/N Hides the option list in the prompt. The message preceding the prompt is displayed, and the options remain enabled.
/CS Allows case-sensitive options to be selected. By default, this tool is case-insensitive.
/T timeout The number of seconds to pause before making a default selection. Acceptable values are from 0 to 9999. If 0 is specified, there will be no pause, and the default option will be selected.
/D choice Specifies the default option after nnnn seconds. The character must be in the set of choices specified with /C; also, /T must be used to specify nnnn.
/M text Specifies the message to display before the prompt. If not specified, the tool only displays the prompt.
/? Displays help message.
Note:
The ERRORLEVEL environment variable is set to the key index selected from the choice set. The first choice listed returns 1, the second choice returns 2, and so on. If the key pressed by the user is not a valid choice, the tool beeps. If the tool detects an error condition, it returns an ERRORLEVEL value of 255. If the user presses Ctrl+Break or Ctrl+C, the tool returns an ERRORLEVEL value of 0. When using the ERRORLEVEL parameter in a batch program, order the parameters in descending order.
Examples:
CHOICE /?
CHOICE /C YNC /M "Press Y to confirm, N to reject, or C to cancel."
CHOICE /T 10 /C ync /CS /D y
CHOICE /C ab /M "Select a for option 1, b for option 2."
CHOICE /C ab /N /M "Select a for option 1, b for option 2."
Recent Ratings for This Post
( 5 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| redtek | +2 | 2006-11-02 23:19 |
| lxmxn | +2 | 2007-01-15 15:33 |
| oilio | +2 | 2007-01-30 01:22 |
| no9ronaldo | +2 | 2008-01-01 23:14 |
| kirov | +2 | 2009-09-11 04:57 |
Attachments



