Change output of pause command in batch script

后端 未结 9 468
孤独总比滥情好
孤独总比滥情好 2020-12-24 11:14

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...".

9条回答
  •  时光说笑
    2020-12-24 12:08

    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)

提交回复
热议问题