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 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.

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 currently executed cmd.exe behaivour.
  • COMMAND is the string or command which will be executed inside the new cmd.exe envrionment as command.
READ  PowerShell Variable Tutorial

cmd.exe Help and Options

cmd.exe help information can be listed with the /? option. These options are incasesensitive 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 off which will do 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 single command but we can use && signs in order to run multiple commands easily. But keep in mind that these string parameter should be closed with the quotation markds.

> 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.

READ  "ipconfig /all" - List All IP Configuration In Windows

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)

call command can be used to execute or run specified command, 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 remove all contents of the current command line or screen. cls command do not accepts 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 list 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
READ  PowerShell New-Item Tutorial

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

Leave a Comment