I have a console program that prints out some data to the stdio. The problem is that when I click the program in explorer. The console pops up, and gone as soon as it prints out the data.

How can I set the console program so that it is not closed after the process is done?

link|improve this question

74% accept rate
feedback

2 Answers

up vote 1 down vote accepted

You could create a shortcut to cmd.exe. Then go into properties and change the target to something like

C:\Windows\System32\cmd.exe /C"yourprogname & PAUSE"

eg

C:\Windows\System32\cmd.exe /C"c:\windows\system32\IPCONFIG & PAUSE"

link|improve this answer
feedback

One simple method would be to wrap the console program in a small batch file with pause on the end. eg sample.bat would list a directory and wait for you to press a button.

DIR
PAUSE

Another option if you simply want to read the text would be to add | clip to the end to redirect the text to the clipboard so you can use it as you want.

eg

DIR | clip

will send a directory listing to the clipboard.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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