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

CommandWhat it does
cdShow the current directory
cd \path\to\dirChange directory (cd .. goes up)
cd /d D:\Change directory and drive
dirList files (dir /a shows hidden)
treeShow the folder structure as a tree
clsClear the screen

Files & folders

CommandWhat it does
type FILEPrint a text file's contents
copy SRC DESTCopy a file
xcopy SRC DEST /E /ICopy folders recursively
robocopy SRC DEST /MIRMirror a folder (robust, resumable)
move SRC DESTMove or rename
del FILEDelete a file (/S recursive, /Q quiet)
md NAME / rd NAMEMake / remove a directory
ren OLD NEWRename a file

System & processes

CommandWhat it does
tasklistList running processes
taskkill /IM name.exe /FForce-kill a process by name
taskkill /PID 1234 /FForce-kill by process ID
systeminfoDetailed OS and hardware info
sfc /scannowScan and repair system files
shutdown /r /t 0Restart now (/s = shut down)

Networking

CommandWhat it does
ipconfig /allShow full network configuration
ipconfig /flushdnsClear the DNS resolver cache
ping HOSTTest connectivity to a host
tracert HOSTTrace the route packets take
nslookup DOMAINLook up DNS records
netstat -anoActive connections with owning PID

Pipes, redirection & chaining

SyntaxWhat it does
CMD > fileRedirect output to a file (>> appends)
CMD1 | CMD2Pipe output into another command
CMD1 && CMD2Run CMD2 only if CMD1 succeeds
find "text" fileSearch for text within a file
setShow / 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

  1. Browse by section.
  2. Find the command you need.
  3. Copy it with one tap.
  4. 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.