/
/

70+ Essential Windows CMD Commands (Beginner to Advanced Cheat Sheet + Examples)

by Lauren Ballejos, IT Editorial Expert
Command line prompt illustration representing a list of useful Windows CMD command prompt commands

Key Points

  • Essential File Commands:
    • copy, del, rename, move, xcopy: Copy, move, rename, or remove files and directories.
    • robocopy: Robust copying and syncing of folders.
    • attrib, cipher, fc, type, copy con, replace: Manage file attributes, encryption, comparisons, and file creation.
  • Directory Navigation:
    • cd, dir, mkdir, rmdir, tree, pushd, popd, path, title: Move between folders, list contents, create/remove directories, and manage navigation shortcuts.
  • Network Tasks:
    • ipconfig, ping, tracert, netstat, nslookup, netsh, arp -a, hostname, pathping, getmac, nbtstat, shutdown /i: Diagnose and configure network settings and connections.
    • net use, net user, telnet, ftp: Manage network resources, user accounts, and remote connections.
  • System Info & Processes:
    • systeminfo, winver, tasklist, taskkill, wmic, set, ver, whoami: Display OS details, view/terminate running processes, manage environment variables, and check logged-in users.
  • Disk Management:
    • diskpart, list disk, select disk, clean, format, chkdsk, label, vol: Partition, check, label, and format disks.
  • Security & Ownership
    • takeown, icacls, cacls, runas, net user, cipher: Manage file ownership, permissions, encryption, and user accounts.
  • Advanced Tricks:
    • Batch Scripting: Automate multiple commands.
    • Redirection & Piping: Combine command outputs (> or |).
    • Environment Variables & Wildcards: Speed up navigation and file operations.
    • Wildcards (*, ?): Perform bulk file operations.
    • Other handy utilities: call, start, pause, echo, cls, exit.
  • Accessing CMD:
    • Search “cmd” and Run as administrator for elevated privileges in Windows 7, 8, 10, or 11.
  • Total Commands: Roughly 280–300 built-in CMD commands exist, but these 70+ are core for daily Windows management.

The Windows Command Prompt (CMD) is one of the most powerful tools in the Windows operating system, yet many users only scratch the surface of what it can do. Whether you’re a beginner learning the basics or an experienced IT professional looking for advanced tricks, fully understanding CMD commands can significantly improve your workflow.

In this guide, we’ve compiled 70+ Windows CMD commands, complete with syntax, real-world examples, and usage tips. We’ll cover everything from file management and network troubleshooting to disk operations and automation.

Save time by automating repetitive tasks. Automate Windows CMD commands execution across multiple endpoints with NinjaOne!

Check out Ninja’s IT Automation System

70+ Useful Windows CMD Commands

15 File management Windows CMD commands

This first group of Windows admin CMD commands simplifies copying, deleting, and managing files and directories, streamlining your daily operations and enhancing your workflow.

Command:Description:
copyCopies one or more files to another location
delDeletes one or more files
rename (ren)Renames a file
moveMoves or renames a file
xcopyCopies files and directories, including trees and hidden/system files
findSearches for a text string in a file or files
robocopyRobust tool for syncing directories, ideal for backups
substMaps a local folder as a drive letter
attribChanges the attributes of a file or directory
cipherEncrypts or decrypts files and folders
fcCompares two files line by line
typeDisplays the content of a text file
copy conCreates a new file directly from the command line
replaceReplaces one or more files with files from another location
edit (if installed)Opens a simple text editor in the command prompt
  1. copy
    Copies one or more files to another location.

Syntax:
copy [source] [destination]

Example:
copy report.docx D:\Backup\

  1. del
    Deletes one or more files.

Syntax:
del [filename]

Example:
del oldfile.txt

  1. rename (or ren)
    Renames a file.

Syntax:
rename [oldname] [newname]

Example:
rename file.txt newfile.txt

  1. move
    Moves a file to a new location or renames it

Syntax:
move [source] [destination]

Example:
move budget.xlsx D:\Reports\

  1. xcopy
    Copies files and directories, including directory trees and system/hidden files, optionally using various parameters for more control.

Syntax:
xcopy [source] [destination] /E /H /C /I

Example:
xcopy C:\Projects D:\Backup /E /H /C /I

  1. find
    Searches for a text string in a file or files, enabling simple text filtering tasks.

Syntax:
find “text” [filename]

Example:
find “error” log.txt

  1. robocopy
    Robust tool for syncing directories, ideal for backups.

Syntax:
robocopy [source] [destination] [options]

Example:
robocopy C:\Data D:\Backup /MIR

  1. subst
    Maps a local folder as a drive letter.

Syntax:
subst [drive:] [path]

Example:
subst X: C:\Projects

  1. attrib
    Changes attributes of a file or directory. You can also use this CMD command in Windows 11: attrib -h -s -r C:pathtofolder to show hidden files.

Syntax:
attrib [+attribute | -attribute] [filename]

Example:
attrib -h -s -r C:\path\to\file.txt

  1. cipher
    Encrypts or decrypts files and folders.

Syntax:
cipher /E [path]

Example:
cipher /E C:\Sensitive

  1. fc
    Compares two files line by line

Syntax:
fc [file1] [file2]

Example:
fc config_old.txt config_new.txt

  1. type
    Displays the content of a text file.

Syntax:
type [filename]

Example:
type readme.txt

  1. copy con
    Creates a new file directly from the command line.

Syntax:
copy con [filename]Type the content, then press Ctrl + Z and Enter to save.

Example:
copy con notes.txt

  1. Replace
    Replaces one or more files with files from another location.

Syntax:
replace [source] [destination] [/A] [/P] [/R]

Example:
replace draft.docx D:\Projects\

  1. edit (if installed)
    Opens a simple text editor in the command prompt.

Syntax:
edit [filename]

Example:
edit config.txt

10 Directory navigation and management Windows CMD commands

Navigate directories and manage folder structures efficiently with these useful Windows CMD commands.

Command:Description:
cdChanges the current directory
cd /Navigates to the root directory
dirDisplays a list of files and subdirectories
mkdir (md)Creates a new directory
rmdir (rd)Removes a directory
treeGraphically displays the folder structure
pushdSaves the current directory and changes to another
popdReturns to the directory stored by pushd
pathDisplays or sets the search path for executable files
titleSets the title for the Command Prompt window
  1. cd
    Changes your current directory.

Syntax:
cd [path]

Example:
cd C:\Users\John\Documents

  1. cd /
    Navigates to the root directory.

Syntax:
cd /

Example:
cd /

  1. dir
    Displays a list of files and subdirectories in a directory.

Syntax:
dir

Example:
dir /p

  1. mkdir (or md)
    Creates a new directory.

Syntax:
mkdir [directoryname]

Example:
mkdir Reports

  1. rmdir (or rd)
    Removes a directory.

Syntax:
rmdir [directoryname]

Example:
rmdir OldFiles

  1. tree
    Graphically displays the folder structure of a drive or path.

Syntax:
tree [drive:][path] [/F]

Example:
tree C:\Projects /F

  1. pushd
    Saves the current directory and changes to another.

Syntax:
pushd [path]

Example:
pushd D:\Work

  1. popd
    Returns to the directory stored by the last pushd command.

Syntax:
popd

Example:
popd

  1. path
    Displays or sets the search path for executable files.

Syntax:
path [pathname]

Example:
path C:\Windows\System32

  1. title
    Sets the title for the Command Prompt window.

Syntax:
title [string]

Example:
title Admin Console

15 Network configuration and diagnostics Windows CMD commands

Network configuration commands are useful when troubleshooting or setting up new network connections.

Command:Description:
ipconfigDisplays current TCP/IP network configuration
pingTests network connectivity to a host
tracertTraces the path packets take to a network host
netstatDisplays active connections and listening ports
nslookupQueries DNS to resolve domain names and IPs
netshConfigures network settings
arp -aDisplays the ARP table
hostnameShows the computer’s network name
pathpingCombines ping and tracert for detailed network info
getmacDisplays the MAC address
nbtstatDiagnoses NetBIOS over TCP/IP
shutdown /iRemote shutdown tool
net useMaps network drives
net userManages local user accounts
telnetConnects to remote servers (if installed)
  1. ipconfig
    Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Additional ipconfig commands are available here.

Syntax:
ipconfig

Example:
ipconfig /all

  1. ping
    Tests the ability to reach a specific network device.

Syntax:
ping [hostname or IP]

Example:
ping google.com

  1. tracert
    Traces the path that a packet takes to reach a network host, helping identify where problems are occurring in the network.

Syntax:
tracert [hostname or IP]

Example:
tracert 8.8.8.8

  1. netstat
    Displays active connections, ports, Ethernet statistics, and the IP routing table.

Syntax:
netstat

Example:
netstat -ano

  1. nslookup
    Queries the DNS to obtain domain name or IP address mapping.

Syntax:
nslookup [hostname]

Example:
nslookup openai.com

  1. netsh
    Allows configuration of almost any aspect of network settings.

Syntax:
netsh [context] [command]

Example:
netsh interface ip show config

  1. arp -a
    Displays current ARP entries by interrogating the current protocol data. It shows the IP address and matching MAC address.

Syntax:
arp -a

Example:
arp -a

  1. hostname
    Shows the computer’s network name, aiding in network identification and troubleshooting.

Syntax:
hostname

Example:
hostname

  1. pathping
    Combines the features of ping and tracert, providing more detailed information about network routes and latency.

Syntax:
pathping [hostname or IP]

Example:
pathping google.com

  1. getmac
    Displays the MAC address of the network card.

Syntax:
getmac

Example:
getmac /v

  1. nbtstat
    Helps diagnose NetBIOS over TCP/IP connections and display protocol statistics.

Syntax:
nbtstat [options]

Example:
nbtstat -n

  1. shutdown /i
    Remote shutdown tool for network management.

Syntax:
shutdown /i

Example:
shutdown /i

  1. net use
    Connects to, removes, or displays shared resources.

Syntax:
net use [drive:] \\computer\share

Example:
net use Z: \\Server\Share

  1. net user
    Manages local user accounts.

Syntax:
net user [username] [password] /add

Example:
net user testuser Pass123 /add

  1. telnet
    Connects to a remote host using the Telnet protocol (if installed).

Syntax:
telnet [hostname or IP] [port]

Example:
telnet mail.example.com 25

8 System information Windows CMD commands

Gathering comprehensive system information is crucial for troubleshooting in safe mode, system monitoring, and ensuring your Windows setup is running optimally.

Command:Description:
systeminfoDisplays detailed system configuration and specs
winverShows the Windows version and build number
tasklistLists all running processes
taskkillEnds processes by PID or image name
wmicAccesses advanced system management info
setDisplays or sets environment variables
verDisplays the current Windows version
whoamiShows the current logged-in user
  1. systeminfo
    Provides a detailed overview of your system, including OS configuration, hardware details, and network information.

Syntax:
systeminfo

Example:
systeminfo

  1. winver
    Quickly checks the version of Windows you are running.

Syntax:
winver

Example:
winver

  1. tasklist
    Lists all currently running processes along with their Process ID (PID).

Syntax:
tasklist

Example:
tasklist /v

💡 Shows verbose process details.

  1. taskkill /PID [pid_number] /F
    Forcefully terminates processes that are unresponsive or consume too many resources. Replace [pid_number] with the actual PID from your tasklist.

Syntax:
taskkill /PID [pid_number] /F

Example:
taskkill /PID 1234 /F

  1. wmic
    Displays Windows Management Instrumentation (WMI) information, allowing more advanced system management through various subclasses (e.g., wmic product get name, wmic cpu get name).

Syntax:
wmic [alias] get [property]

Example:
wmic cpu get name

  1. set
    Displays or sets environment variables.

Syntax:
set [variable=[value]]

Example:
set PATH

  1. ver
    Displays the Windows version in text form.

Syntax:
ver

Example:
ver

  1. whoami
    Displays the current logged-in username.

Syntax:
whoami

Example:
whoami

8 Disk management Windows CMD commands

Disk management commands give you the flexibility to manage your storage resources directly from the command line, offering a powerful alternative to graphical user interface tools.

Command:Description:
diskpartOpens the Disk Partition utility
list diskLists all disks connected to the computer
select diskSelects a disk to manage
cleanRemoves all partitions from the selected disk
formatFormats a disk with a specified file system
chkdskChecks a disk for errors and repairs them
labelChanges or creates a volume label
volDisplays the volume label and serial number
  1. diskpart
    A tool for managing disk partitions.

Syntax:
diskpart

Example:
diskpart

  1. list disk
    Displays all disks connected to the computer.

Syntax:
list disk

Example:
list disk

  1. select disk
    Selects the disk you want to perform operations on.

Syntax:
select disk [number]

Example:
select disk 1

  1. clean
    Removes all partitions and data from the selected disk.

Syntax:
clean

Example:
clean

  1. format
    Formats a disk with a specified file system.

Syntax:
format [drive:] /FS:[filesystem]

Example:
format D: /FS:NTFS

  1. chkdsk
    Checks the disk for errors and repairs the file system.

Syntax:
chkdsk [drive:] [parameters]

Example:
chkdsk C: /f

  1. label
    Changes or creates the volume label of a disk.

Syntax:
label [drive:] [label]

Example:
label E: BackupDrive

  1. vol
    Displays the volume label and serial number of a disk.

Syntax:
vol [drive:]

Example:
vol C:

Keep your systems and endpoints secure through automated patching and custom CMD scripts with NinjaOne.

Try it for free today!

6 Security & ownership Windows CMD commands

These commands help you manage file/folder ownership, permissions, encryption, and access control directly from the Command Prompt, making them valuable for system administrators and IT pros.

Command:Description:
takeownTakes ownership of a file or folder
icaclsDisplays or modifies file/folder permissions
caclsLegacy command to display or change permissions
runasRuns a program as another user
net userManages user accounts and passwords
cipherEncrypts or decrypts files and folders
  1. takeown
    Takes ownership of a file or folder.

Syntax:
takeown /F [path] [/R] [/D Y]

Example:
takeown /F C:\SecureFolder /R /D Y

This takes ownership of SecureFolder and all subfolders/files.

  1. icalcs
    Displays or modifies access control lists (ACLs) for files and directories.

Syntax:
icacls [filename] [/grant User:Permission]

Example:
icacls C:\SecureFolder /grant John:F

This grants the user “John” full access (F) to SecureFolder.

  1. calcs
    Displays or changes file permissions (older command, still available).

Syntax:
cacls [filename] [/G User:Permission]

Example:
cacls report.doc /G John:F

This grants the user “John” full access to report.doc

  1. runas
    Runs a program as another user.

Syntax:
runas /user:[domain\]username program

Example:
runas /user:Admin cmd

This opens a Command Prompt as the Admin user.

  1. net user
    Manages user accounts, including password changes.

Syntax:
net user [username] [newpassword]

Example:
net user John SecurePass123

This changes the password for the user “John”.

  1. cipher
    Encrypts or decrypts files and folders using the Encrypting File System (EFS).

Syntax:
cipher /E [path]

Example:
cipher /E C:\Sensitive

This encrypts all files in the “Sensitive” folder.

4 Advanced Command Prompt Tricks

In addition to your Windows CMD commands list, advanced Command Prompt tricks can significantly enhance your productivity, automate tasks, and manage system operations more efficiently. These tricks often involve a combination of commands, scripting, and deeper system functionalities that go beyond basic command-line input.

Here are some advanced tricks and the reasons why they are beneficial:

1. Batch Scripting

Batch files allow you to automate repetitive tasks. By writing a script that contains a series of commands, you can run these commands sequentially without manual input each time, saving time and reducing errors.

Why it’s useful:

  • Ideal for routine maintenance tasks.
  • Can be scheduled to run automatically with Windows Task Scheduler.
  • Reduces the chance of typos or human error in repetitive work.

Syntax:
@echo off
command1
command2
pause

Example: Create a backup.bat file to copy important documents.

@echo off
xcopy C:\Work D:\Backups /E /H /C /I
echo Backup completed successfully!
pause

💡 Note: What does @echo off mean?

You may be wondering what @echo means and why you need to start your commands with it.

  • echo off tells the Command Prompt not to display each command before running it, which keeps the output clean.
  • @ hides the echo off line itself, so you don’t see it in the console.
  • Always use @echo off at the start of your batch scripts for a cleaner look.

2. Piping and Redirection

Using the pipe (|) and redirection (>, >>) operators, you can chain commands together or direct their output to files or other programs. For example, you can pipe the output of a dir command into findstr to search for specific files or redirect the output of a command to create a text file.

Why it’s useful:

  • Piping allows you to filter, transform, or pass the output of one command directly into another.
  • Redirection lets you save command results for later review, logging, or automation.

Syntax:

    • Piping
      command1 | command2
    • Redirect to a file (overwrite)
      command > filename.txt
    • Redirect to a file (append)
      command >> filename.txt

Example:

    • Search for “report” in a directory listing
      dir | find “report”
    • Save a process list to a file
      tasklist > processes.txt
    • Append error messages to an existing log
      ping 8.8.8.8 >> networklog.txt

💡 Tip: Difference between > and >>

  • > will overwrite the file if it exists.
  • >> will append to the file, preserving its contents.

3. Environment Variables

Understanding and using environment variables can help you quickly access system paths and user settings and modify command behaviors. For instance, using %USERPROFILE% to access the current user’s home directory simplifies navigation and file management tasks.

Why it’s useful:

  • Allows scripts to adapt to different systems and users without hardcoding paths.
  • Speeds up navigation to commonly used locations.

Syntax:
%VARIABLE_NAME%

Common environment variables:

    • %USERPROFILE% : Current user’s home directory.
    • %TEMP% : Temporary files folder.
    • %PATH% : Directories where executables are searched.
    • %HOMEDRIVE% : The drive letter associated with your home directory.

Example:

    • Go to the user’s Documents folder
      cd %USERPROFILE%\Documents
    • Open the temporary files directory
      cd %TEMP%

💡 Tip: Viewing all environment variables:

Run the command set. This displays all currently defined environment variables in your system.

4. Using Wildcards

Wildcards (* and ?) can make file management commands like copy, move, and del more powerful by allowing you to specify patterns that match multiple files, which is useful for batch operations on files.

Why it’s useful:

  • Quickly target multiple files without typing each name.
  • Ideal for bulk cleanup, renaming, or file organization.

Syntax:

    • Asterisk (*) : Matches zero or more characters.
    • Question mark (?) : Matches exactly one character.

Example:

    • Delete all .tmp files in the current folder
      del *.tmp
    • Copy all files starting with “report” to another folder
      copy report* D:\Reports\
    • Rename all .txt files to .bak
      ren *.txt *.bak

💡 Tip: Use these wildcard commands with caution. Wildcards don’t ask for confirmation by default, so a command like del *.docx will delete all Word documents in the directory instantly. Use /p with del to prompt before each delete, so the command will look like this: del *.docx /p

6 Other handy utilities: Windows CMD commands

These extra CMD commands don’t fit neatly into the other categories but are incredibly useful for everyday administration, scripting, and troubleshooting.

Command:Description:
callRuns one batch file from another and returns control when finished
startOpens a new CMD window or launches a program
pausePauses batch execution until a key is pressed
echoDisplays messages or toggles command display
clsClears the Command Prompt screen
exitCloses the Command Prompt window
  1. call
    Runs another batch file or program from within the current batch file, returning control to the original after completion.

Syntax:
call [filename]

Example:
call backup.bat

This executes backup.bat and then returns to the calling script.

  1. start
    Starts a program, opens a document, or launches a new Command Prompt window.

Syntax:
start [program or filename]

Example:
start notepad.exe

This opens Notepad.

  1. pause
    Pauses batch file execution and waits for the user to press a key. Useful for reading output before the window closes.

Syntax:
pause

Example:
pause

This will display “Press any key to continue…”

  1. echo
    Displays messages in the Command Prompt or toggles command echoing on/off.

Syntax:
echo [message]

Example:
pause

This will display “Press any key to continue…”

  1. cls
    Clears the Command Prompt screen, removing all previous text from view.

Syntax:
cls

Example:
cls

  1. exit
    Closes the current Command Prompt session.

Syntax:
exit

Example:
exit

How to access Windows Command Prompt

To use the Windows CMD commands in Windows 10 or any other version, you must first know how to access Windows Command Prompt. The steps can vary slightly depending on your version of Windows.

For Windows 8, 8.1, 10 and 11

Follow these steps for standard access:

  1. Click on the taskbar.
  2. Type “cmd” in the search field.
  3. Select “Command Prompt.”

To gain elevated privileges, follow these steps to access Command Prompt as an administrator:

  1. Right-click on “Command Prompt” from the search results.
  2. Select “Run as administrator.”

Run Command Prompt as Administrator

For Windows 7

  1. Navigate by clicking “Start” → “All Programs” → “Accessories”.
  2. For standard user rights, click on “Command Prompt.”
  3. For administrative rights, right-click on “Command Prompt” and choose “Run as administrator.”

With Command Prompt, you can use Windows CMD commands in Windows 10, 11, or earlier versions to manage files, directories, network settings, and more.

Discover what IPConfig is and why does it matter – watch our video.

Frequently Asked Questions (FAQ)

How many Windows CMD Commands are there?

The number of commands available in Windows Command Prompt can vary slightly depending on the version of Windows you are using. However, in general, there are around 280 to 300 built-in commands in CMD. This includes both simple commands used for everyday tasks like the copy command in Windows CMD, and more advanced utilities for system diagnostics and configuration.

💡 We’ve written a guide on How to Display and Use CMD Commands: A Complete Guide.

What is the difference between CMD and PowerShell?

CMD (Command Prompt) is a legacy Windows command-line interpreter best for quick administrative tasks and basic scripting. PowerShell is a more modern and powerful shell that supports advanced scripting, automation, and integration with Windows Management Instrumentation (WMI) and .NET.

💡 Need a refresher? Sign up for this free crash course, PowerShell for IT Ninjas

How do I run CMD as an administrator?

Search for “cmd” in the Start menu, right-click Command Prompt, and select Run as administrator. On Windows 10 and 11, you can also press Windows + X and choose Windows Terminal (Admin).

Can CMD commands be automated?

Yes. CMD commands can be combined into batch (.bat) files and automated using Windows Task Scheduler, making it easy to run scripts at set times or in response to specific triggers.

Are CMD commands the same in all versions of Windows?

Most core CMD commands work across Windows 7, 8, 10, and 11, but some commands and parameters are version-specific. Always check the syntax using the /?” help switch (e.g., chkdsk /?) to confirm availability in your version.

Mastering Windows CMD commands

By mastering these Windows CMD commands, you can move beyond basic computer use and start managing your system like a true IT pro. We recommend keeping this guide as a handy reference so you are always prepared for any situation. It may be a good idea to experiment with different commands as well (in a safe test environment, of course!). The more you practice, the more second-nature these commands will become.

Tired of manual command-line troubleshooting? See how NinjaOne can help you automate and manage IT systems effortlessly—watch a demo.

You might also like

Ready to simplify the hardest parts of IT?