Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

An .exe which is runs via cmd.exe runs and then quickly disappears before I can read the error message. How can I get the cmd.exe window and error message to not close? Or is there anyway to log that error info that just flashed? Thanks.

share|improve this question

4 Answers 4

Starting a program that launches console will indeed close the window, because CMD is no longer needed.

If you press start and type cmd and press enter, you will launch a command prompt.

Press the driveletter the program is on if this is not on C:, followed by a : and press enter.

In the below examples the _ at the end represents your cursor.




now, use the command cd to navigate to the directory of the program. You can press tab to autocomplete names. Tootab would make Tools if that folder exists.


D:\>cd Tools_

D:\Tools>cd "My Program"_   <- type 'My' and press tab to Autocomplete to "My Program"

D:\Tools\My Program>_

Now enter the name of the program you want to run.


D:\Tools\My Program>program_
Hello, I am the error message you want to see.

D:\Tools\My Program>_
share|improve this answer
you can use the /D switch to switch drive letters with cd so cd /D C:\Tools will always go to the directory no matter where you are currently –  ratchet freak Jul 4 '14 at 11:01
I am aware, but I wanted to keep the post as simple as possible. –  LPChip Jul 4 '14 at 11:21
Easier way : open the explorer, navigate to the directory and call "cmd" from the address bar. –  Lyrkan Jul 4 '14 at 13:31
@LPChip It's a default feature of Windows 7/8 that works without any additional software. If you already opened the right path in the terminal there is an even more convenient way though: Shift + Right Click -> Open command window here –  kapep Jul 4 '14 at 13:50
Or even easier, open the command prompt, and drag and drop the program into it - Windows will insert the full path to the executable into the command prompt. Then just hit enter. –  Moshe Jul 4 '14 at 13:52

Normally when I have to do this I create a bat file in the same folder (so new text file rename to whatever.bat) open in text folder then type:

Name of exe Pause

Close and save then run the bat file and it should keep it open!

share|improve this answer
Can you add some instructions on how to do this? An average user that knows how to make a .bat file would also know how to pause at the end. –  LPChip Jul 4 '14 at 9:21

You can use .bat file to run that exe.

Also, you can use the following command in cmd to log the error/output of that exe file into a text file:

myFile.exe >> "C:\logFile.txt"

Double greater than symbol appends to the existing file " >> " however, single symbol overwrite the existing file ">".

Hope this will help you to log the error.

share|improve this answer
Actually, many programs print to stderr. >> will only log stdout. You need to add a 2>&1, e.g. command 2>&1 >>log.txt –  Bob Jul 4 '14 at 14:19

You need to run it in an already-existing instance of cmd.exe. You can press and hold shift and right-click in a directory then click "Open command window here". Then either type the name of an exe or click and drag it into the command window, then press enter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.