Windows 7: keeping a command prompt window opened!

May 2017

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.

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

Related


Published by deri58. Latest update on March 12, 2012 at 07:54 AM by Virginia Parsons.
This document, titled "Windows 7: keeping a command prompt window opened!," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).