Batch-Script: CMD Window should remain open after Program Run
Question by CSchaf | Last update on 2023-01-20 | Created on 2014-09-04
I have written a small batch script that is calling and executing a program. This application is writing some information into the console (I mean the black CMD or command line interpreter window that is opened when clicking on a BAT-file).
My problem is that Windows automatically closes that window, so that I can not see the output of my program. I have already tried to take a screenshot exactly at the moment the window shortly pops up, but this is not a good solution.
Is there any possibility to keep the command prompt window open and not to close it automatically?
Related Topics
Windows Batch Script: Computer Shutdown
Tutorial | 2 Comments
Windows: How to run a Program as Administrator - Once, Always or with Shortcut
Tutorial | 0 Comments
Delphi/Lazarus: Command Line Parameter Tutorial Part 1: Sending
Tutorial | 0 Comments
Windows: How to make Hibernation available
Tutorial | 0 Comments
Put Windows via Script into Hibernation or Sleep Mode
Tutorial | 0 Comments
Close Batch-Script-Window after Program Start
Question | 1 Answer
jQuery: Submit complete form and receive content with Ajax
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You can just use the command "pause".
For example in the following way:
This batch script executes the program "prog.exe" and as soon as the script comes across the line "pause", it stops. Then, the message "Please press any key..." is displayed and only after pressing a key, the script will be resumed and with this the window is closed.
Using this command, you should be able to read the output of the program without any problems.
Last update on 2023-01-20 | Created on 2014-09-04
You could also do that as an example:
The command "timeout" will then stop the script for the specified time (here for 7 seconds).
2022-10-30 at 20:49