在批处理脚本中更改暂停命令的输出

问题描述:

我正在编写Windows批处理脚本.默认情况下,pause命令将暂停脚本并显示文本按任意键继续..."..

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

如何修改此文本以向用户显示我自己的文本?

How do I modify this text to display my own text to the user?

您可以使用以下方法隐藏pause命令中的文本:

You could hide the text from the pause command by using this:

pause >nul

然后,您可以回显自己的消息,告诉用户它已暂停:

Then you could echo your own message to tell the user it has paused:

echo The batch file has paused

因此完整的脚本可能看起来像这样:

So the full script might look like this:

@echo off
echo Hello World!
echo The batch file has paused
pause >nul

希望这会有所帮助:)