Windows CMD.exe or Command Shell Tutorial with Examples
cmd.exe is standard shell and command line interface for all of the Windows operating system. Currently Powershell is preferred one but
cmd is useful and popular too. In this tutorial we will look some features of the
Open Command Line Shell
We can open command shell or
cmd in different ways. We can open it from Program Files. But the most practical way is opening with
Run prompt. We will write
cmd to the run and hit enter.
Run and Close Cmd
We can provide the command we want to run in cmd shell environment with
/C option. We will also specify the command we want to run.
In this example we will run
dir command and then close cmd
> cmd /C dir
If we want to see the close effect we can run this command in
Run and Return Cmd
If we need to run command in a new cmd shell and then do not close the cmd in order to see command output we can run
> cmd /K dir
Run Program with Parameter
We generally need to provides parameters to the commands executed by
cmd . We can provide these parameters after the command like below. In this example we will provide the file name to the command.
> cmd dir "c:\Users"
Turn Echo Off
Commands those creates output to the shell will print output the the
cmd . We can turn these output off to make things more clear.
> cmd /Q dir