Navigation and files
| Command | What it does | Tip |
|---|---|---|
cd / chdir | Change directory | cd /d D:\data switches drive and path |
dir | List files | dir /a shows hidden; /s recurses—can be slow on large trees |
mkdir / rmdir | Create or remove directories | rmdir /s /q is destructive—double-check the path |
copy / move / del | Copy, move, delete files | There is no recycle bin for plain del |
type | Print a text file | Binary files will garble the console—use GUI tools instead |
findstr | Search text patterns in files or pipes | Regex is limited—quote patterns with spaces |
Identity and environment
whoami prints the current security principal; whoami /groups shows token groups for privilege debugging. hostname returns the computer name. echo %cd% shows the current directory; echo %PATH% helps diagnose command-not-found issues. where appname locates executables on PATHEXT.
Networking quick hits
ipconfig /all for addresses and DNS; ping and tracert for reachability and path; netstat -ano for listening ports with PIDs. Pair tasklist /fi "PID eq …" with netstat output.
Redirection and safety
Use > and >> to capture output to a file; 2>&1 merges stderr in CMD. Many maintenance commands (sfc, dism, disk operations) require Run as administrator—open an elevated prompt deliberately rather than working around UAC.
Related: CMD vs PowerShell, Windows networking commands, ipconfig explained, ping explained.