How to disable the command prompt's auto-close upon completion?

Solution 1:

Instead of running that .bat file directly from Explorer or whatever other method you use, manually launch cmd.exe(if needed with elevated privileges) and then run your .bat file from there. Then upon completion of its execution you will still see all the output...just like in the good old DOS days. :)

Solution 2:

In your .bat file, use the pause command. It will prevent your .bat file from closing.

For example, this is my bat file I use to start MySQL service on my PC:

net start MySQL
pause

Note: On Windows 7 I start this .bat file from Administrator's name. To do this click right mouse's button on your .bat file and chose "Start from Administrator's name" from the dropdown menu.

Solution 3:

You need to use the /k switch when calling.

Useful details here.