Windows 7: keeping a command prompt window opened!

August 2016

A command can be run in the Windows 7 operating system through the run tab in the start menu. Commands can be directly entered along with the parameters to be executed. The command window in Windows operating systems closes as soon as the command is executed. This makes it very difficult to check the logs or messages printed during the execution of the command. To keep the command prompt window open, a parameter needs to be defined through the cmd command. Using the /k parameter with all commands, the command prompt window remains open until it is closed by the user.

In the Start menu and the Run tab you can insert the name of a program or a command to run under Windows 7.

These commands are different from each other and of different types: Shell, Windows or DOS.


Often, when we enter a particular command, it is not possible to see the results, since the console will close once the command is executed.


  • It is possible to keep the command prompt window open, simply by inserting the parameter before the name of the command > cmd /k <.
  • Don't forget to leave a space between "cmd" and "/k"
  • Here is an example:

Use command in Run> ipconfig / all

The window disappears suddenly.

Executing a command with the parameter: cmd /k

Then insert this command: cmd /k ipconfig / all

See also :

This document entitled « Windows 7: keeping a command prompt window opened! » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.