windowsbatch-filecmd

Change message 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?


Solution

  • 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