Make windows batch file not close upon program exit

I believe you are looking for the command "pause". It should ask you to press any key.

You can even appear to change the prompt. Instead of just using the pause statement, you can:

echo "Your message here"
pause > nul

This gets rid of the original pause message and inserts yours.

Jacob


A part of me says that "pause" in the batch file should also do the trick. But also give the /K switch a try as well.

HTH


In Windows/DOS batch files:

pause

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

Or, if you don't want to show anything message, do this instead:

pause >nul

Create a shortcut to your batch file.

Right click on the file and select "Properties".

In the tab "Shortcut" is the target, something like this:

C:\folder\file.bat

Change it by this one:

C:\Windows\System32\cmd.exe /K "C:\folder\file.bat"

where "C:\Windows\System32" is the folder where cmd.exe is located, which may be another according to your Windows installation.

Then you can run the shortcut.