Stop the command prompt from disappearing after execution

For most of the tasks I use the keyboard shortcuts. The touchpad comes in to picture only when there is no shortcut for a particular task or I don’t recollect the shortcut. Hence to launch any applications I use Start –> Run dialogue more often than not.

As a DBA while troubleshooting issues, I need to quickly check the IP Address of a computer. The easiest approach is to run the ipconfig command. By practice, I open Start –> Run and execute ipconfig.

But soon after executing this, the ipconfig window appears but it disappears quickly because the command prompt window does not “stay”. Then I would open cmd from the Run dialogue and hit ipconfig.

If you find this approach too long and would like to save a couple of key depressions, here is the approach that I use. Instead of executing ipconfig or any other command from Run, cmd.exe has a switch named /k. Using this switch, the given command would be executed but the command prompt window does not disappear but it would remain. The new approach to execute ipconfig from Run, would be like the one below.

After executing with cmd with the /k switch, the command prompt would stay.

This might not be a big trick but it is useful while doing certain repeating tasks from the Run dialogue.

6 thoughts on “Stop the command prompt from disappearing after execution

  1. blah

    “Then I would open cmd from the Run dialogue and hit ipconfig” :
    cmd <-'
    ipconfig <-'
    keystrokes : 13

    "If you find this approach too long and would like to save a couple of key depressions.." :
    cmd /k ipconfig <-'
    keystrokes : 16

    Reply
  2. kina

    This is entirely unhelpful. There is a setting, somewhere, that will keep the cmd prompt up until you close it yourself for anything that brings it up. I just can’t remember what that setting is or where to find it.

    I would think that information would be far more helpful since it would eliminate the need to worry about using the extra characters.

    Reply
    1. PradeepAdiga Post author

      Even I would learn if you could post that setting which will keep the command prompt window open persistently.

      Reply
  3. Pingback: Something for the Weekend - SQL Server Links 01/04/11

Leave a Reply