Is there a way to prompt users for input (ie: Yes/No) from a Dos batch script that works on XP and Windows 2003 server? It seems some commands (ie: choice) only work on one OS and not others.
+1
A:
Note that the SET /P
command does not support all the same features as the CHOICE
command. Namely:
- It doesn't restrict the user to entering a valid value
- The user has to press enter
- You have to check for casing differences (e.g. "A" vs "a")
- There is no way to default to a certain choice after a certain amount of time
For these reasons, I still prefer to use the CHOICE
command rather than the SET /P
command. To do this, you just need to include CHOICE.COM along with your batch file. You can download CHOICE.COM from Microsoft via the MS-DOS 6.22 Supplemental Disk. Here's the link:
James Messinger
2009-11-10 16:20:20