Another way to keep terminal window open

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
data808
Posts: 47
Joined: 19 Jul 2012 01:49

Another way to keep terminal window open

#1 Post by data808 » 26 Oct 2022 03:02

At the end of the batch file I have "pause" to keep the window open. However, any time I press any key, as the terminal states, this causes the window to close. I would like to keep the window open so that I can do a search for keywords within the terminal window using CTRL+F. Is there another function besides "pause" that can achieve this?

Thanks for your help on this.

OJBakker
Expert
Posts: 90
Joined: 12 Aug 2011 13:57

Re: Another way to keep terminal window open

#2 Post by OJBakker » 26 Oct 2022 04:06

If you have exit commands in your batchfile change these to exit /b
Make a shortcut to your batchfile.
Change the target of the shortcut to:

Code: Select all

cmd /k fullpathandnameofyourbatchfile.cmd
If you start the batchfile with the shortcut then the window will stay open until you close it or use the exit command.

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Another way to keep terminal window open

#3 Post by ShadowThief » 26 Oct 2022 17:41

Simply run the script from the command prompt instead of double-clicking it and the window will stay open after the script ends.

You're new, so I'll oversimplify - never ever double click scripts!

Post Reply