I was having a hard time with command prompt windows when I created and ran my batch files – they wouldn’t stay open and kept closing before I could see its output.
Then I discovered the PAUSE command – by adding this command to your batch file, you’ll pause the window for as long as you want, keeping it open so that you can read the output it generates!
So if you want your command prompt DOS window to stay open, then use this following piece of code in your batch file:
REM Put your main code here
ECHO Halting operation. Please press enter to continue.
PAUSE>NUL means that the output of PAUSE will be redirected to the NUL device. This command allows you to replace the default PAUSE message with your own, using an ECHO command before it. In this example, the user will see the message “Halting operation. Please press enter to continue.” Once the user presses enter, the command window will close.
- How To Make and Run Batch Files In Terminal In Mac OSX
- How To Solve The Problem Of Always Having To Log On To A Network Drive In Windows
- How To Create a Stored Procedure using C#, SQL Server 2008, Visual Studio 2008
- Recursively Delete Selected Files or Folders In Windows
- How To Find Out What’s Locking Files or Folders in Mac