Using ANSI Characters with the CHOICE Command (96697)



The information in this article applies to:
    Microsoft MS-DOS operating system 6.0
    Microsoft MS-DOS operating system 6.2
    Microsoft MS-DOS operating system 6.21
    Microsoft MS-DOS operating system 6.22

This article was previously published under Q96697

SUMMARY

The CHOICE command prompts you to make a choice in a batch program. It displays a specified prompt and pauses for you to choose from among a specified set of keys. You can only use this command in batch programs.

The CHOICE command allows only one key to be used per selection. For example, you cannot use "12" as a key selection. CHOICE interprets this as "1" and "2"; however, you can use the ANSI character set equivalent for 12 by holding down the ALT key and pressing the appropriate key combination on the numeric keypad. Not all combinations work, but you can use up to 222 different entries from the 255 available. The table below details which characters work.
   Key Combination    Work?
   ---------------    -----

   0-27               No
   28-31              Yes
   32                 No
   33-255             Yes (some exceptions noted below)

MORE INFORMATION

ALT+37 displays the percent sign (%). If you use the percent sign in a batch file, it acts as a replaceable parameter. You must use two percent signs (one immediately after the other) to use the % symbol. To do this, press the ALT+37 key combination twice.

ALT+47 displays the forward slash (/). The forward slash does not work with CHOICE.

ALT+60 displays the opening bracket (<). The opening bracket represents a redirector and does not work with CHOICE.

ALT+62 displays the closing angle bracket (>). The closing bracket represents a redirector and does not work with CHOICE.

ALT+124 displays the pipe character (|). The pipe represents the MS-DOS pipe and does not work with CHOICE.

ALT+127 represents the DEL (delete) key. The DEL key does not work with the CHOICE command.

ALT+255 represents SPACEBAR. This character works if you press ALT+255. It does not work if you press SPACEBAR.

If you use the extended characters between 128 and 165, use the /S switch to treat choice keys at case sensitive.

Modification Type: Major Last Reviewed: 11/16/1999
Keywords: KB96697