Windows CMD Cheat Sheet
A quick reference for the Windows Command Prompt, file and folder commands, networking, disk and system tools, plus handy keyboard shortcuts.
A reference for the classic Windows Command Prompt (cmd.exe). Commands are
case-insensitive. Type command /? for built-in help on any command.
Navigating & listing
| Command | What it does |
|---|---|
cd | Show the current directory |
cd \path\to\dir | Change directory (cd .. goes up) |
cd /d D:\ | Change directory and drive |
dir | List files (dir /a shows hidden) |
tree | Show the folder structure as a tree |
cls | Clear the screen |
Files & folders
| Command | What it does |
|---|---|
type FILE | Print a text file's contents |
copy SRC DEST | Copy a file |
xcopy SRC DEST /E /I | Copy folders recursively |
robocopy SRC DEST /MIR | Mirror a folder (robust, resumable) |
move SRC DEST | Move or rename |
del FILE | Delete a file (/S recursive, /Q quiet) |
md NAME / rd NAME | Make / remove a directory |
ren OLD NEW | Rename a file |
System & processes
| Command | What it does |
|---|---|
tasklist | List running processes |
taskkill /IM name.exe /F | Force-kill a process by name |
taskkill /PID 1234 /F | Force-kill by process ID |
systeminfo | Detailed OS and hardware info |
sfc /scannow | Scan and repair system files |
shutdown /r /t 0 | Restart now (/s = shut down) |
Networking
| Command | What it does |
|---|---|
ipconfig /all | Show full network configuration |
ipconfig /flushdns | Clear the DNS resolver cache |
ping HOST | Test connectivity to a host |
tracert HOST | Trace the route packets take |
nslookup DOMAIN | Look up DNS records |
netstat -ano | Active connections with owning PID |
Pipes, redirection & chaining
| Syntax | What it does |
|---|---|
CMD > file | Redirect output to a file (>> appends) |
CMD1 | CMD2 | Pipe output into another command |
CMD1 && CMD2 | Run CMD2 only if CMD1 succeeds |
find "text" file | Search for text within a file |
set | Show / set environment variables |
Use Tab to autocomplete paths, the ↑/↓ arrows to recall previous commands, and Ctrl+C to cancel. For modern scripting, see the PowerShell cheat sheet.
What this does
A Windows CMD cheat sheet collects the most useful Command Prompt commands — files and folders, networking, disk and system tools, plus handy shortcuts.
How to use it
- Browse by section.
- Find the command you need.
- Copy it with one tap.
- Run it in Command Prompt.
Example
ipconfig /all shows every network adapter’s full configuration.
Sources & methodology
Last updated .
Frequently asked questions
How do I open the Command Prompt?
Press Win+R, type cmd, and press Enter. For commands that change the system, right-click and choose "Run as administrator".
Should I use CMD or PowerShell?
CMD is simpler and great for quick, classic commands. PowerShell is far more powerful for scripting and object-based output, see our PowerShell cheat sheet.
How do I get help for a command?
Type the command followed by /? (for example, dir /?) to see its options and usage.
Related tools
Linux Command Cheat Sheet
The essential Linux terminal commands on one page, files and navigation, permissions, processes, networking, and package managers. A quick reference for the bash shell.
PowerShell Cheat Sheet
A reference for Windows PowerShell, discovering cmdlets, the object pipeline, filtering and formatting, managing files, processes and services, plus variables and flow control.
macOS Terminal Cheat Sheet
A reference for the macOS Terminal, the Mac-only commands (open, pbcopy, mdfind), system and defaults tools, Homebrew, core Unix commands, and keyboard shortcuts.
IBM AS/400 (IBM i) Cheat Sheet
A reference for the IBM i (AS/400, OS/400) command line, the work-with commands, libraries and objects, spooled files and output queues, messages, and 5250 function-key shortcuts.