Ask a question »

Windows 7: keeping a command prompt window opened!

July 2015

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.

Windows 7: keeping a command prompt window opened!





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.

Issue


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.

Solution

  • 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

For unlimited offline reading, you can download this article for free in PDF format:
Windows-7-keeping-a-command-prompt-window-opened.pdf

See also

In the same category

Original article published by tribun. Translated by deri58. - Latest update by Virginia Parsons
This document entitled « Windows 7: keeping a command prompt window opened! » from CCM (ccm.net) 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.