Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make windows batch file not close upon program exit

Tags:

When the program is over, I want it to say "Press any key to continue..." so I can scroll thru the output.

like image 486
Claudiu Avatar asked Aug 18 '09 05:08

Claudiu


People also ask

How do I keep a batch file window open?

Edit your bat file by right clicking on it and select “Edit” from the list. Your file will open in notepad. Now add “PAUSE” word at the end of your bat file. This will keep the Command Prompt window open until you do not press any key.

How do I hold my screen in cmd?

Type the "cmd /k" parameter before every command to keep the window from closing.


1 Answers

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

like image 180
TheJacobTaylor Avatar answered Sep 17 '22 12:09

TheJacobTaylor