Command Prompt — cmd.exe — is the classic Windows command line interpreter. It's been around since the NT days, and it's still installed on every copy of Windows 10 and Windows 11. Windows Terminal is just a modern host app; CMD, PowerShell, and WSL all run inside it. Why bother when you can click? Speed, mostly. Checking your IP configuration takes one command instead of four clicks. Repairing system files, killing a frozen process, creating a user account — all faster typed than hunted for in Settings.
This is a working cheat sheet: basic commands, networking tools, repair utilities, admin commands, operators, and a full reference table at the end. Every entry has an example. Some commands need an elevated session, so learn to open Command Prompt as administrator before you go further.
📌 What is CMD?
CMD stands for Command, which is sometimes known as Command Prompt or Windows Command Processor informally. It is a command-line interpreter application for the Windows operating system that Microsoft develops. It is used to carry out complex administrative duties such as managing system attributes, files, and users by executing commands input in the terminal. In other words, you can use CMD to control your operating system.
✅ Why Command Prompt is Useful
The Command Prompt offers significant utility in the world of computing. Its usefulness extends to a variety of scenarios, making it an essential tool for both novice and experienced users.
- Automation of Tasks: One of the primary advantages of Command Prompt is its ability to automate tedious and repetitive tasks with ease. By scripting a sequence of commands, users can perform complex operations quickly, saving time and effort.
- Sequential Command Execution: The Command Prompt allows users to execute multiple commands sequentially, one after the other. This sequential execution is particularly valuable when performing tasks that involve a series of steps or configurations.
- Speed and Efficiency: Checking your IP configuration, repairing system files, or killing a frozen process — all faster typed than hunted for in Settings menus.
🚀 How to Open CMD on Windows
- Start menu: type
cmd, press Enter. - Run dialog: press
Win + R, typecmd, press Enter. - Administrator mode: type
cmdin Start, then pressCtrl + Shift + Enter. Accept the UAC prompt. The window title will read "Administrator: Command Prompt."
📝 CMD Syntax Basics for Beginners
Every command follows the same shape: command + arguments + switches. In ipconfig /all, ipconfig is the command and /all is the switch that expands the output. In del C:\temp\log.txt, the path is the argument.
Two rules save beginners a lot of pain. First, wrap any path containing spaces in double quotes: cd "C:\Program Files". Second, when you don't know a switch, append /? — as in xcopy /? — or just run help for the built-in list. Commands themselves aren't case-sensitive. File paths aren't either.
📁 Basic CMD Commands
Start here. These cover file management, navigation, and system utilities — the commands you'll use 80% of the time.
CD (Change Directory)
- Syntax: CD [/D] [drive:][path]
- Example:
cd C:\Users
cd C:\Users
cd ..
cd /d D:\BackupsChange Directory (CD) is used to navigate between folders or drives quickly. The optional /D parameter lets you change both the drive and directory. Full walkthrough here: change directories in CMD.
DIR (List Files)
- Syntax: DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
- Example:
dir /s
dir
dir /s
dir /a:hLists files in the current folder. Use dir /s to include subfolders, dir /a:h for hidden files.
MKDIR (Make Directory)
- Syntax: mkdir [:]
- Example:
mkdir fantastic
mkdir projectsCreates new directories or folders within existing directories. Simply provide the path to the new directory you want to create. Related: create a file in CMD.
REN (Rename)
- Syntax: ren [:][]
- Example:
ren old.txt new.txt
ren report.docx report_final.docxThe Rename command (REN) is used to rename files. Provide the current filename followed by the desired new filename.
COPY
- Syntax: COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B] source [/A | /B] [+ source] [destination]
- Example:
copy report.docx D:\Backup\
copy report.docx D:\Backup\Copies a single file from source to destination.
DEL (Delete)
- Syntax: DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
- Example:
del *.tmp
del *.tmpDeletes files. There's no Recycle Bin here. Gone is gone.
TYPE
- Syntax: TYPE [drive:][path]filename
- Example:
type notes.txt
type notes.txt
type notes.txt | morePrints a text file to the screen. Pipe it through more for long files.
CLS (Clear Screen)
- Syntax: CLS
- Example:
cls
clsClears the screen. Cosmetic, but you'll use it constantly.
ASSOC (Fix File Associations)
- Syntax: assoc [.ext[=[fileType]]]
- Example:
assoc .txt
assoc .txtASSOC is crucial for managing file associations. It helps you link file extensions to specific programs, ensuring that .txt files open with the correct text editor.
FC (File Compare)
- Syntax: FC /a [/c] [/l] [/lb] [/n] [/off[line]] [/t] [/u] [/w] [drive1:][path1]filename1 [drive2:][path2]filename2
- Example:
FC File1.txt File2.txt
FC File1.txt File2.txtThe File Compare (FC) command enables you to compare two files and identify differences. It can be useful for checking changes between versions of files.
POWERCFG (Power Configuration)
- Syntax: powercfg /option [arguments]
- Example:
powercfg /?
powercfg /?
powercfg /energyPOWERCFG provides insights into your system's power settings and efficiency. It's invaluable for diagnosing power-related issues and optimizing power consumption.
ATTRIB (Change File Attributes)
- Syntax: ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [drive:][path][filename] [/S [/D]]
- Example:
ATTRIB +R C:\example.txt
ATTRIB +R C:\example.txt
attrib -h -s file.txtThis command is used to change file attributes. +R sets the file as read-only, +H makes the file hidden, -S clears the system attribute.
ROBOCOPY (Robust File Copy)
- Syntax: ROBOCOPY Source Destination [File][Options]
- Example:
ROBOCOPY C:\source D:\destination /MIR
ROBOCOPY C:\Data D:\Backup /MIR /ZRobocopy is used for copying files and directories in a more advanced manner than the standard copy command. Far better than copy for bulk transfers. /MIR mirrors a directory and deletes files at the destination that no longer exist at the source — so test first.
🌐 CMD Network Commands
IPCONFIG (IP Configuration)
- Syntax: ipconfig [/all] [/renew []] [/release []] [/flushdns] [/displaydns] [/registerdns]
- Example:
ipconfig /all
ipconfig
ipconfig /all
ipconfig /flushdns
ipconfig /release
ipconfig /renewDisplays detailed network configuration information, including IP address, subnet mask, default gateway, and more. ipconfig /flushdns clears the DNS cache — the first thing I try on a "site won't load but others do" complaint.
PING (Send Test Packets)
- Syntax: ping [/t] [/n ] [/l ] [/f] [/w ]
- Example:
ping 8.8.8.8
ping 8.8.8.8
ping google.comSends ICMP echo requests to a target host, checking network connectivity and measuring response times. If IPs reply but names fail, it's DNS. Also useful for finding an IP address.
TRACERT (Trace Route)
- Syntax: tracert [/d] [/h ] [/w ]
- Example:
tracert google.com
tracert google.comTraces the route that packets take to reach a destination, displaying hop-by-hop information and helping pinpoint network latency or failures.
PATHPING
- Syntax: pathping [/n] [/h ] [/g ] [/p ] [/q ] []
- Example:
pathping google.com
pathping google.comCombines the features of TRACERT and PING to provide a comprehensive analysis of network latency and packet loss along the route. Slower, but more useful for intermittent issues.
NETSTAT (Network Statistics)
- Syntax: netstat [-a] [-b] [-e] [-n] [-o] [-p ] [-r] [-s] []
- Example:
netstat -ano
netstat -anoLists open ports with owning process IDs. Cross-reference the PID with tasklist to find which application is listening on a specific port.
NSLOOKUP (Name Server Lookup)
- Syntax: nslookup [-h HOST] [-p PORT] object
- Example:
nslookup monovm.com
nslookup monovm.comRetrieves domain name or IP address information by querying DNS servers, aiding in network troubleshooting and domain-related tasks.
GETMAC (Media Access Control)
- Syntax: getmac[.exe][/s [/u <domain\ [/p ]]][/fo {table | list | csv}][/nh][/v]
- Example:
getmac
getmacDisplays the MAC (Media Access Control) addresses of network adapters on a local or remote computer.
ARP (Address Resolution Protocol)
- Syntax: arp [/a [] [/n ]] [/d ] [/s ]
- Example:
arp -a
arp -aDisplays and manipulates the ARP cache, resolving IP addresses to MAC addresses and vice versa.
NBTSTAT
- Syntax: nbtstat [/a ] [/A ] [/c] [/n] [/r] [/R] [/RR] [/s] [/S] []
- Example:
nbtstat -n
nbtstat -nOffers insights into NetBIOS over TCP/IP statistics, helping diagnose issues related to NetBIOS name resolution and connectivity.
NETSH (Network Configuration Tool)
- Syntax: netsh [-a ] [-c ] [-r ] [{ | -f }]
- Example:
netsh wlan show profiles
netsh wlan show profilesManages network settings, interfaces, and configurations. The example lists all wireless network profiles — that's also the route to find your WiFi password using CMD.
Troubleshooting order that works: ipconfig /all → ping 8.8.8.8 → ping google.com → nslookup google.com → ipconfig /flushdns → tracert. That sequence isolates the layer in under two minutes. For deeper coverage see our guide to CMD commands for networking, and if you're stuck on name resolution, fix DNS issues with CMD tools.
🔧 System Repair and Diagnostics
All of these need an administrator prompt.
SYSTEMINFO (System Information)
- Syntax: systeminfo [/s [/u \ [/p ]]] [/fo {TABLE | LIST | CSV}] [/nh]
- Example:
systeminfo
systeminfoProvides a wealth of system-related information — OS build, install date, RAM, domain, patch list, and more.
SFC (System File Checker)
- Syntax: SFC [/scannow] [/verifyonly] [/scanfile=] [/verifyfile=]
- Example:
SFC /SCANNOW
SFC /SCANNOWSystem File Checker verifies and repairs protected Windows files from the local component store. Takes 10–20 minutes.
DISM (Deployment Image Servicing and Management)
- Syntax: DISM /Online /Cleanup-Image /RestoreHealth
- Example:
DISM /Online /Cleanup-Image /RestoreHealth
DISM /Online /Cleanup-Image /RestoreHealthRepairs the component store itself, using Windows Update as the source. Run this before SFC if SFC reports it couldn't fix everything. For a full walkthrough, read our guide on how to repair Windows with DISM command.
CHKDSK (Check Disk)
- Syntax: CHKDSK [drive:][[path]filename] [/F] [/R] [/X]
- Example:
CHKDSK C: /F
CHKDSK C: /F
CHKDSK C: /F /RChecks the specified disk for structural integrity and fixes logical file system errors. The /F option fixes errors on the disk. Quick distinction: SFC fixes system files, DISM fixes the repair source, CHKDSK fixes the disk.
DRIVERQUERY
- Syntax: driverquery [/S system] [/U username] [/P [password]] [/FO format] [/NH] [/SI] [/V]
- Example:
driverquery
driverqueryLists installed drivers with versions. Useful for troubleshooting hardware issues.
BCDEDIT (Boot Configuration Data Editor)
- Syntax: BCDEDIT [/set] [id] [property] [value]
- Example:
BCDEDIT /enum
BCDEDIT /enumManages boot configuration data, useful for troubleshooting startup issues. Read-only unless you know exactly what you're changing. A bad edit means an unbootable machine.
👤 Admin, Process, and Disk Commands
NET USER (User Account Management)
- Syntax: NET USER [username [password | *] [options]] [/DOMAIN]
- Example:
NET USER administrator *
NET USER administrator *
NET USER jsmith *Manages user accounts on the computer. The example command sets a password interactively for the specified user.
NET LOCALGROUP (Local Group Management)
- Syntax: NET LOCALGROUP [groupname [/COMMENT:"text"]] [/DOMAIN]
- Example:
NET LOCALGROUP Administrators John /ADD
NET LOCALGROUP Administrators John /ADDAdds or removes users from local groups. In the example, the user John is added to the local Administrators group.
TASKLIST (List Processes)
- Syntax: TASKLIST [/S system] [/U username] [/P password] [/M [module]] [/SVC] [/V] [/FI filter] [/FO format]
- Example:
TASKLIST /FI "IMAGENAME eq notepad.exe"
TASKLIST
TASKLIST /FI "IMAGENAME eq notepad.exe"Displays a list of currently running processes, similar to the information available in Task Manager but accessible via CMD.
TASKKILL (Terminate Tasks)
- Syntax: TASKKILL [/S system] [/U username] [/FI filter] [/PID processid | /IM imagename] [/T] [/F]
- Example:
TASKKILL /IM notepad.exe /F
TASKKILL /IM notepad.exe /F
TASKKILL /PID 1234 /FEnds one or more tasks or processes. The example command forcefully terminates all instances of Notepad.
SC (Service Control)
- Syntax: SC [command] [service_name] [options]
- Example:
SC queryex type= service state= all
SC query wuauserv
SC stop wuauserv
SC start wuauservManages Windows services. This example queries the status of all services on the system.
GPRESULT (Display Group Policy Information)
- Syntax: GPRESULT [/S system] [/U username] [/P [password]] [/SCOPE scope] [/USER targetusername] [/R | /V | /Z]
- Example:
GPRESULT /R
GPRESULT /RDisplays Group Policy settings and Resultant Set of Policy (RSoP) for a user or a computer.
GPUPDATE (Group Policy Update)
- Syntax: GPUPDATE [/FORCE] [/LOGOFF] [/BOOT] [/SYNC]
- Example:
GPUPDATE /FORCE
GPUPDATE /FORCERefreshes Group Policy settings, applying any changes made. The /FORCE option forces all policies to be updated.
ICACLS (Change File and Folder Permissions)
- Syntax: ICACLS name [/reset] [/T] [/C] [/L] [/Q]
- Example:
ICACLS C:\windows\* /reset /T
ICACLS C:\Data
ICACLS C:\Data /grant jsmith:(OI)(CI)FDisplays and modifies file and folder permissions. Careless use can lock you out, so read carefully before executing.
NET USE (Map Drives)
- Syntax: net use [devicename | *] [\\computername\sharename[\volume]] [/persistent:{yes | no}]
- Example:
net use /Persistent:Yes
net use Z: \\server\share
net use /Persistent:YesSimplifies the process of mapping network drives. You can create a mapped drive to a shared folder with this command.
SHUTDOWN (Shutdown or Restart Computer)
- Syntax: SHUTDOWN [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\computer] [/t xxx]
- Example:
SHUTDOWN /r /t 0
SHUTDOWN /r /t 0
SHUTDOWN /s /t 60Shuts down or restarts the computer. The first example restarts immediately, the second schedules a shutdown in 60 seconds.
DISKPART (Disk Partitioning Tool)
- Syntax: DISKPART
- Example: After entering DISKPART, use
LIST DISKto show all disks.
DISKPART
LIST DISK
SELECT DISK 0DISKPART is a powerful command-line utility for managing disk partitions. This tool will erase drives without asking twice. Always run list disk and confirm the size before anything else.
WMIC (Windows Management Instrumentation Command-line)
- Syntax: WMIC [context] [where clause] [verb clause]
- Example:
WMIC OS GET name
WMIC OS GET nameWMIC provides a command-line interface for Windows Management Instrumentation (WMI). Note that wmic is deprecated in current Windows 11 builds — use PowerShell's CIM cmdlets for new scripts.
⚡ Operators, Shortcuts, and Redirection
- Command History: Press
F7to display a list of previously executed commands. Arrow keys cycle through history. Thedoskey /historycommand also shows your session history. - Run Multiple Commands: Chain them with
&&to run the next command only if the previous one succeeded. Use||to run it only if the previous one failed. For example:ipconfig /flushdns && ipconfig /renew. - Send Output to Clipboard: Pipe the result directly to the Windows clipboard with
| clip. For instance,Assoc.txt | clipcopies the output to your clipboard. - Redirect Output to File:
dir > list.txtoverwrites output to a file.>>appends.2> errors.txtcaptures standard error only. - Abort a Command: Press
CTRL+Cto stop a running command immediately. - Batch Files: Save a series of commands in a
.batfile and double-click to replay them. That's CMD scripting in one sentence.
🔄 CMD vs PowerShell
| Factor | CMD | PowerShell |
| Learning curve | Shallow — short commands | Steeper — verb-noun cmdlets |
| Output | Plain text | Structured objects |
| Scripting power | Basic batch files | Full scripting language, modules, remoting |
| Best for | Quick checks, legacy tools, repair utilities | Automation, bulk admin, Azure/Microsoft 365 |
They're not rivals. PowerShell runs almost every CMD command anyway. I use CMD for a fast ping and PowerShell when I need to loop over 200 servers.
⚠️ Common CMD Errors and Fixes
- "Access is denied": You're in a standard prompt. Reopen as administrator, or the file is locked by a running process.
- "The system cannot find the path specified": Typo, or an unquoted path with spaces. Add quotes around paths like
"C:\Program Files". - "'x' is not recognized as an internal or external command": The executable isn't in your PATH variable. Use the full path or add its folder to PATH.
📊 CMD Commands Cheat Sheet Table
| Command | Category | Purpose | Example | Risk |
| dir | Files | List folder contents | dir /s |
Low |
| cd | Files | Change directory | cd /d D:\ |
Low |
| mkdir | Files | Create a folder | mkdir projects |
Low |
| ren | Files | Rename a file | ren old.txt new.txt |
Low |
| copy | Files | Copy a file | copy a.txt D:\ |
Low |
| del | Files | Delete files permanently | del *.tmp |
Medium |
| type | Files | Display text file | type notes.txt |
Low |
| robocopy | Files | Bulk mirrored copy | robocopy C:\A D:\B /MIR |
Medium |
| attrib | Files | Change file attributes | attrib -h -s file.txt |
Low |
| assoc | Files | File associations | assoc .txt |
Low |
| fc | Files | Compare two files | fc file1.txt file2.txt |
Low |
| ipconfig | Network | IP configuration | ipconfig /all |
Low |
| ping | Network | Test reachability | ping 8.8.8.8 |
Low |
| tracert | Network | Trace route | tracert google.com |
Low |
| pathping | Network | Advanced trace with stats | pathping google.com |
Low |
| netstat | Network | Open ports and PIDs | netstat -ano |
Low |
| nslookup | Network | Query DNS | nslookup monovm.com |
Low |
| getmac | Network | MAC addresses | getmac |
Low |
| arp | Network | ARP cache | arp -a |
Low |
| sfc | Repair | Fix system files | sfc /scannow |
Low (admin) |
| DISM | Repair | Repair component store | DISM /Online /Cleanup-Image /RestoreHealth |
Medium |
| chkdsk | Disk | Check file system | chkdsk C: /f |
Medium |
| systeminfo | Repair | System information | systeminfo |
Low |
| tasklist | Process | List processes | tasklist | findstr chrome |
Low |
| taskkill | Process | End a process | taskkill /PID 1234 /F |
Medium |
| net user | Admin | Manage accounts | net user jsmith * |
Medium |
| net localgroup | Admin | Manage groups | net localgroup Admins John /ADD |
Medium |
| icacls | Admin | File permissions | icacls C:\Data |
High |
| shutdown | Admin | Restart or shut down | shutdown /r /t 0 |
Medium |
| diskpart | Disk | Partition management | list disk |
High |
| bcdedit | Boot | Boot configuration | bcdedit /enum |
High |
| gpupdate | Admin | Refresh Group Policy | gpupdate /force |
Medium |
| gpresult | Admin | Group Policy results | gpresult /r |
Low |
| powercfg | System | Power configuration | powercfg /energy |
Low |

🚀 Where to Go Next
Learn ten commands properly rather than fifty badly: dir, cd, copy, del, ipconfig, ping, tasklist, taskkill, sfc, and help. That set handles most everyday Windows problems. For a broader reference, browse our list of important Windows commands.
Managing a remote box? A Windows VPS gives you full administrator access via RDP and CMD — whether you need Windows 10 VPS for familiar desktop management or Windows Server 2022 VPS for enterprise workloads. All our plans include full admin rights, so every command in this guide works exactly as shown.
Prefer to start with a general-purpose environment? Check out our VPS server options.
I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.