Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

windows - Change output of pause command in batch script

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?

question from:https://stackoverflow.com/questions/9258822/change-output-of-pause-command-in-batch-script

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

Hope this helps :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...