MS-DOS is an operating system and shell used to run commands and provide a command-line interface in Windows operating systems. cmd.exe is used to interpret and provide a console for the MS-DOS command. cmd.exe provides different options where cmd /c
is a popular one. cmd /c
is used to run commands in MS-DOS and terminate after command or process completion.
Run Command and Terminate with CMD /C
We can run commands in MS-DOS or in cmd.exe
by using cmd /c
. We will also add the command string we want to run. For example, if we want to run ping poftut.com we will issue the following command. The command will create a process that will run command and then terminate after the command execution is completed. Also using ” double quotes in order to surround command are very useful.
> cmd /c "ping poftut.com"

Run Command and Terminate with CMD /C On-Run Command Prompt
We can run cmd /c
and related commands from the Run Command prompt. We can open Run Command Prompt from the Start menu or with the Windows Key+R key combination and write the cmd /c "ping poftut.com"
command like below. Keep in mind that after the execution of the command is completed the MS-DOS windows will be terminated or closed automatically.

Run Command and Terminate with CMD /C On Search Prompt or Box
Another alternative to run commands with the cmd /c
we can use Search Prompt or Box. We will click to the Start Menu and write down the complete command. This will also show the command with the MS-DOS icon like below. This will work like previous examples.

Run Command and Terminate with CMD /C On-Run Command Prompt
Alternatively, we can run cmd /c
command from a regular command line or MS-DOS. This will open a new MS-DOS shell and run given command. After the command execution is over the newly created MS-DOS shell will be terminated or closed automatically.
> cmd /c "ping poftut.com"

Run Multiple Commands
We can run multiple commands with the cmd /c
. We just need to provides them in double-quotes by separating them with space. In this example, we will run ping poftut.com
, ping google.com
, mkdir test
in the following example.
> cmd /c "ping poftut.com" "ping google.com" "mkdir test"
Run Bat File and Terminate
Bat or batch files are used to run multiple commands from a file. This will make recurring tasks easier. We can run a bat file by providing its path and name to the cmd /c
like below. In this example, we will run the batch file backup.bat
> cmd /c C:\backup.bat
Run Command and Return To CMD Prompt with CMD /K
As stated previously cmd /c
will run given the command and terminate a new shell or process after the command is completed. If we do not want to terminate a new process we can use /K
option where a newly created process or window will remain without closing.
> cmd /k "ping poftut.com"