I\'m writing a Windows batch script. By default, the pause
command will pause the script and display the text "Press any key to continue...".
Starting from Windows 2000 (so, not XP) you can use the choice
command which is far more powerful than either pause
or set /p
.
Besides being able to specify your own prompt text, you can also require the user to type a specific key, and only that key, instead of being limited to, and requiring, [Enter]
to be pressed.
Also, you can prompt the user to press a number of different keys and take action based on which key was pressed.
Type choice /?
for help, or read more about it here: Wikipedia: choice (command)