How to prevent auto-closing of console after the execution of batch file

joe picture joe · Jun 12, 2009 · Viewed 681k times · Source

What command can I put at the end of a batch file to prevent auto-closing of the console after the execution of the file?

Answer

Dave Bauman picture Dave Bauman · Jun 12, 2009

In Windows/DOS batch files:

pause

This prints a nice "Press any key to continue . . . " message

Or, if you don't want the "Press any key to continue . . ." message, do this instead:

pause >nul