What Does “cmd /c” Means In Windows MS-DOS?

The cmd or cmd.exe is the MS-DOS command prompt. The cmd is executed when the MS-DOS or command prompt started in Windows. The “cmd /c” is a popular usage where the “/c” is provided to execute a specified string as a command in MS-DOS. After the provided command execution is completed the created shell will be closed.

The “cmd /c” Syntax

The “cmd /c” syntax is like below.

cmd /c COMMAND
  • COMMAND is the command which is executed in MS-DOS interpreter.

Run Command and Terminate In MS-DOS

The cmd is used to execute MS-DOS commands. Actually, it is an interpreter that reads provided commands and interprets them, and as the last step executes them. The command is provided as a text. Even command text can be provided without a special sign using the double quotes is a very good best practice.

cmd /c "ping windowstect.com"

Run Multiple Commands with “cmd /c”

The “cmd /c” supports multiple commands in a single execution. We can provides multiple commands by putting them inside the double quotos and separating them with the spaces. In the following examle we will execute 3 commands.

cmd /c "ping windowstect.com" "mkdir test" "cd test"

Run Command and Terminate In Windows Run

Another useful case for the “cmd /c” is running MS-DOS commands via the Windows Run. First we will open the Windows Run with the WIN+R key shortcut. Then type the following command which will ping to the windowstect.com . After the ping command is completed the MS-DOS terminal exit automatically.

cmd /c "ping windowstect.com"
Run Command and Terminate In Windows Run

Run Command and Terminate In Start Menu

Another use case for the “cmd /c” is running commands via the Start Menu. This may sound strange but using the Start Menu search box MS-DOS commands can be executed. When the command is typed the MS-DOS icon and provided command is displayed in the Start Menu.

cmd /c "ping windowstect.com"
Run Command and Terminate In Start Menu

Run Command and Terminate In PowerShell

By defualt the MS-DOS commands are supportef by the PowerShell command line interface. But in some cases there may be some compability problems about this. By using the “cmd /c” command the MS-DOS commands can be executed in PowerShell without any problem.

cmd /c "ping windowstect.com"
Run Command and Terminate In PowerShell

“cmd /c” vs “cmd /k”

The “cmd /c” is used to create a new shell, execute the provided command, and exit from the shell automatically. The cmd.exe also provides the /k option which will not exit from the created shell automatically. It will stay the newly created and command executed shell. This can be helpful to test some variables and results.

Leave a Comment