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.

Related posts:

  1. Run Windows Scheduled Task from Command Line
  2. How to get server hardware information from command line
  3. Passing parameters to a Windows Batch file
  4. Managing cluster groups from command line
  5. SQL Server Cluster resource doesn’t come online | Service control: stop before startup
This entry was posted in SQLServerPedia Syndication and tagged , . Bookmark the permalink.

5 Responses to Stop the command prompt from disappearing after execution

  1. blah says:

    “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

  2. David says:

    I am using notepad++ as java editor: http://npp-community.tuxfamily.org/documentation/notepad-user-manual/commands

    cmd /k cd “$(CURRENT_DIRECTORY)” && javac “$(FILE_NAME)” && java “$(NAME_PART)”

  3. karan says:

    Thanks, this helped. I needed a way to launch a command from another application I was developing and this worked.

  4. kina says:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>