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.

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?

share|improve this question
add comment

2 Answers

up vote 2 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"

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.