The Windows CD command (Change Directory) moves your Command Prompt session into another folder. Almost every CLI workflow starts here: you cd to the right place, then run dir, scripts, builds, or tools.
Official reference: Microsoft Learn — CD / CHDIR.
What does CD do?
cd Documents
If you were in C:\Users\You, you are now in C:\Users\You\Documents. The prompt path updates so you always know where you are.
chdir is the same command — cd is the short form everyone uses.
Essential CD patterns
Go up one level
cd ..
From C:\Users\You\Documents you land in C:\Users\You.
Go up two levels:
cd ..\..
Jump to a drive’s root
cd \
That goes to the root of the current drive (for example C:\).
Switch drives
cd alone does not change the active drive letter the way beginners expect. To work on D::
D:
cd \Projects
Or in one step with /d:
cd /d D:\Projects
/d means: change drive and directory together. Memorize this — it saves constant confusion.
Paths with spaces
Quote them:
cd "C:\Program Files"
Without quotes, CMD splits on the space and fails.
Absolute vs relative
-
Relative:
cd Documents(from where you are) -
Absolute:
cd C:\Users\You\Documents(full path)
Use absolute paths in scripts; relative paths when exploring by hand.
Handy navigation tricks
See where you are
cd
With no arguments, cd prints the current directory.
Tab completion
Type cd Doc then press Tab — CMD expands matching folder names. Fewer typos, faster moves.
Jump back with pushd / popd
pushd C:\Windows\System32
rem ... do work ...
popd
pushd saves your place and moves; popd returns. Great for quick detours.
Quick reference
| Goal | Command |
|---|---|
| Enter folder | cd FolderName |
| Up one level | cd .. |
| Drive root | cd \ |
| Drive + folder | cd /d D:\Work |
| Path with spaces | cd "Program Files" |
| Print location | cd |
Practice CD until it is automatic
Folder navigation is the foundation of every other command.
CMD Master is a free online interactive learning platform for the command line. Practice Windows CMD, PowerShell, and Bash in a live browser terminal with instant feedback — no install, no VM. Most lessons are free. For a guided Windows path, open the interactive Windows Command Prompt course.
Further reading
- Microsoft Learn: CD — official syntax
- CMD Master — interactive CLI practice
Top comments (0)