Is there a way in Windows 7 to create a shortcut to a command-line (console) application and leave the command window open?

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.


Solution 1:

Use cmd.exe

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

command line does NOT go away until you exit it.

Solution 2:

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