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.

There are a number of console type applications, e.g. ipconfig, that output information to the standard output.

The problem is that if I create a windows shortcut to them it runs the command and closes the console window before I can read the output.

I realize that I could create a batch file with a pause command and then make the shortcut go to that batch file, but I was wondering if there was any generic way I could configure a shortcut to a console/command-line type program to leave the window open until the user explicitly closes it.

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

Use cmd.exe

cmd /k ipconfig
cmd /k ping google.com
cmd /k etc..........

command line does NOT go away until you exit it.

share|improve this answer
    
Tough to pick a winner on this one because all of these answers work, but I'm going with this one because it is the simplest of the approaches offered. –  JohnFx Aug 13 '10 at 15:26
    
@JohnFx: In the meanwhile there is a better solution which is just as simple. –  oberlies Nov 7 '13 at 14:50
add comment

Probably you can't. I thought there was an option to set, but on Windows Seven, I cannot find anything like this.

Like you said, the easiest way is to make a batch file. Note that you can make it perfectly generic. Create a file generic.bat containing:

%1
pause

then call it with a shortcut:

generic.bat ipconfig
share|improve this answer
    
That's a really good idea! –  JohnFx Aug 13 '10 at 15:24
add comment

Alternatively, you can use the /c option with cmd.exe like so:

%COMSPEC% /c ipconfig&&pause
share|improve this answer
    
IMHO the best solution, but doesn't work if the first command signals an error (through a non-zero exit code). This only works when using a single ampersand: %COMSPEC% /c <command> & pause –  oberlies Nov 7 '13 at 14:48
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.