Windows cmd.exe (Command Interpreter) Tutorial

cmd.exe is an executable file that is provided with all modern Microsoft windows Operating systems in order to interpret commands. The cmd name comes from the command and is also named as Windows Command Processor . Another alternative name is MS-DOS where Microsoft DOS commands can be interpreted and executed via cmd.exe. As its extensions suggest it’s an executable while where multiple cmd.exe can be run at the same time. The cmd.exe is created in 1987 and provided all Windows operating systems starting with this date. The cmd.exe is also referred as Command Processor Shell .

How To Open cmd.exe?

cmd.exe can be opened in different ways. Below we will list some of the most practical ways to open cmd.exe. The easiest way is using the Start Menu and typing msdos or cmd.exe or command prompt etc. We can see that the cmd.exe is named as Command Prompt in the start menu.

How To Open cmd.exe?

there are some commands which are related to system administration. In order to administrate the system and change settings, the commands should be executed with the Administrator privileges.

So the cmd.exe can be opened with the administrator privileges by clicking on the Run as administrator in the screenshot above. When the cmd.exe is opened we will see the following command-line interface. It will be called as Command Prmpt and the current working directory is the C:\Users\ismail which is the current user home directory.

cmd.exe or MS-DOS

If the cmd.exe is opened with the Administrator privileges the window header will also contain the Administrator text.

cmd.exe Syntax

cmd.exe has very simple syntax where the options and command are specified as a string like below. After opening the command prompt there is no need to run cmd.exe again. But in some cases in order to change the current command prompt or cmd.exe behavior we can use it explicitly like below.

  • OPTION is the parameter or option which will change the currently executed cmd.exe behavior.
  • COMMAND is the string or command which will be executed inside the new cmd.exe environment as a command.

cmd.exe Help and Options

cmd.exe help information can be listed with the /? option. These options are case-insensitive and can be used as lower case or uppercase.

> cmd.exe /?
/cExecute the given command and quit.
/kExecute the given command and continue.
/qTurns the echo which will not print the commands to standard output.
/dDisables execution of AutoRun commands.
/aFormats internal command output to a pipe or a file as American National Standards Institute (ANSI).
/uFormat output as Unicode.
/e:onEnables command extensions.
/e:offDisables commands extensions.
/f:onEnables file and directory name completion.
/f:offDisables file and directory name completion.
/v:onEnables delayed environment variable expansion.
/v:offDisables delayed environment variable expansion.
<string>Specifies the command you want to carry out.
/?Displays help at the command prompt.

Print cmd.exe Versions

If the cmd.exe is executed without any option or command the output will be the cmd.exe current version and copyright information.

Microsoft Windows [Version 10.0.19041.508]
(c) 2020 Microsoft Corporation. All rights reserved.

Run Multiple Commands with cmd.exe

By default cmd.exe command parameter is interpreted as a single command but we can use && signs in order to run multiple commands easily. But keep in mind that these string parameters should be closed with quotation marks.

> cmd.exe "dir&&mkdir test"

> cmd.exe "cd test && mkdir windowstect && mkdir pythontect"

Popular cmd.exe Commands

As an old command-line interpreter or command prompt a lot of different commands can be executed by using the cmd.exe. Below we will list some of the most useful and popular commands which can be interpreted inside the cmd.exe.

cd (Change Directory)

cd command is used to change the current working directory.

C:\Users\ismail>cd ..

C:\Users>cd ..

C:\>cd Users\ismail


call (Execute Specified Command, Executable or Script)

The call command can be used to execute or run specified commands, executable or script by specifying it.

 call cmd.exe
C:\Users\ismail> call backup.bat
C:\Users>call c:\Users\ismail\backup.bat

cls (Clear Screen)

cls command is used clear or removes all contents of the current command line or screen. cls command do not accept any option or parameter.


cmd.exe (Command Interpreter)

cmd.exe can be called to enter into a new command-line interpreter. All specified options can be used

Microsoft Windows [Version 10.0.19041.508]
(c) 2020 Microsoft Corporation. All rights reserved.

dir (List Directories and Files)

dir command simply lists the current working directory or specified path files and folders.

 Volume in drive C has no label.
 Volume Serial Number is 801B-D913

 Directory of C:\Users\ismail

10/06/2020  04:23 PM    <DIR>          .
10/06/2020  04:23 PM    <DIR>          ..
08/26/2020  08:02 AM    <DIR>          .idlerc
08/26/2020  06:00 PM               178 .packettracer
10/06/2020  04:24 PM    <DIR>          3D Objects
07/06/2020  11:34 AM    <DIR>          Cisco Packet Tracer 7.3.0
10/06/2020  04:24 PM    <DIR>          Contacts
10/06/2020  04:24 PM    <DIR>          Desktop
10/06/2020  04:24 PM    <DIR>          Documents
10/08/2020  02:44 PM    <DIR>          Downloads
10/06/2020  04:24 PM    <DIR>          Favorites
10/06/2020  04:24 PM    <DIR>          Links
10/06/2020  04:24 PM    <DIR>          Music
09/10/2020  11:27 AM    <DIR>          OneDrive
10/06/2020  04:24 PM    <DIR>          Pictures
05/21/2020  10:36 AM    <DIR>          PycharmProjects
10/06/2020  04:24 PM    <DIR>          Saved Games
10/06/2020  04:24 PM    <DIR>          Searches
09/25/2020  02:40 PM    <DIR>          Test
10/06/2020  04:24 PM    <DIR>          Videos
               1 File(s)            178 bytes
              19 Dir(s)  63,030,775,808 bytes free

C:\Users\ismail>dir C:\
 Volume in drive C has no label.
 Volume Serial Number is 801B-D913

 Directory of C:\

12/07/2019  12:14 PM    <DIR>          PerfLogs
10/07/2020  03:07 AM    <DIR>          Program Files
10/07/2020  03:07 AM    <DIR>          Program Files (x86)
08/26/2020  08:02 AM                28
10/06/2020  04:10 PM    <DIR>          Users
10/06/2020  04:23 PM    <DIR>          Windows
10/06/2020  04:23 PM    <DIR>          Windows.old
               1 File(s)             28 bytes
               6 Dir(s)  63,030,775,808 bytes free

mkdir (Make Dir will Create Directory)

mkdir command is used to make or create directories.

C:\Users\ismail> mkdir wisetut

rmdir (Remove Directory will Remove or Delete Directory)

rmdir command is used to remove or delete directories.

C:\Users\ismail> rmdir wisetut

Run cmd Commands In PowerShell

PowerShell is the next-generation command-line interface and scripting language for Windows operating systems. But for backward compatibility, the PowerShell supports cmd commands and features. The cmd commands can be executed in PowerShell like below. the –% is used to control PowerShell $ symbols and the PowerShell variables can be used.

PS> $dirname = "C:\test"
PS> cmd.exe --% /c mkdir "$dirname" 

All cmd.exe Command-List

The cmd.exe supports a lot of commands even some of them are very popular and used regularly. The following list provides all cmd.exe commands supported by Windows operating system.

  • assoc
  • break
  • call
  • cd
  • chdir
  • cls
  • color
  • copy
  • date
  • del
  • dir
  • dpath
  • echo
  • endlocal
  • erase
  • exit
  • for
  • ftype
  • goto
  • if
  • keys
  • md
  • mkdir
  • mklink(introduced in Windows Vista)
  • move
  • path
  • pause
  • popd
  • prompt
  • pushd
  • rd
  • rem
  • ren
  • rename
  • rmdir
  • set
  • setlocal
  • shift
  • start
  • time
  • title
  • type
  • ver
  • verify
  • vol

1 thought on “Windows cmd.exe (Command Interpreter) Tutorial”

Leave a Comment