Page 1 of 1

Another way to keep terminal window open

Posted: 26 Oct 2022 03:02
by data808
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.

Re: Another way to keep terminal window open

Posted: 26 Oct 2022 04:06
by OJBakker
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.

Re: Another way to keep terminal window open

Posted: 26 Oct 2022 17:41
by ShadowThief
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!