Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .