How To Change Directories In Command Prompt (2027)
To change directories in Command Prompt on Windows 11, type cd followed by the folder path and press Enter.
If the folder is on another drive, add the /d switch or Command Prompt will stay on the current drive.
This guide covers every cd variation Microsoft documents, from going up one folder to jumping between network locations.
Table of Contents
- Quick answer: the cd commands you need
- How to open Command Prompt in Windows 11
- How to change to a folder with cd
- How to go up a folder or back to the root
- How to change drives in Command Prompt
- What do the parts of a cd command mean?
- How to cd into a folder with spaces in its name
- How to check which directory you are in
- What are pushd and popd and when should I use them?
- Does cd care about upper and lower case?
- Example: moving through folders step by step
- Which command should I use?
- How to see the built-in help for cd
- How to turn command extensions off
- Why does cd not change my drive?
- Does this work in Windows Terminal and Windows 10?
- Related Command Prompt guides
- Official sources
Quick answer: the cd commands you need
| What you want | Command | Example |
|---|---|---|
| Go into a folder | cd <path> | cd Users\Public |
| Go up one folder | cd .. | cd .. |
| Go to the root of the current drive | cd\ | cd\ |
| Switch to a folder on another drive | cd /d <drive>:<path> | cd /d D:\Projects |
| Show the current directory | cd (no parameters) | cd |
| Go and remember where you were | pushd <path> | pushd C:\Temp |
The chdir command does exactly the same thing as cd, according to Microsoft.
How to open Command Prompt in Windows 11
- Select Start or the Search icon on the taskbar.
- Type
cmd. - Select Command Prompt from the results.
You can also press the Windows key + R, type cmd and press Enter.
Only open it as administrator when a task needs it, as our guide to opening an elevated Command Prompt explains.
How to change to a folder with cd
The syntax Microsoft gives is cd [/d] [<drive>:][<path>].
- Type
cd, a space, then the path of the folder. - Press Enter.
- Check that the prompt now shows the new folder.
For example, cd Users\Public typed from C:\ moves the prompt to C:\Users\Public.
How to go up a folder or back to the root
- Up one level: type
cd ..to move to the parent folder. - To the root: type
cd\to return to the root directory of the current drive.
You can chain levels by running cd .. once for each folder you want to climb.
How to change drives in Command Prompt
Microsoft says the /d switch changes the current drive as well as the current directory.
- Type
cd /d D:\and press Enter to switch to the D drive. - Or add a path, such as
cd /d D:\Projects.
Without /d, a command like cd D:\Projects changes the saved directory for drive D but does not move you there.
| Command typed at C:\Users | Result | Why |
|---|---|---|
| cd Public | C:\Users\Public | Relative path from the current folder |
| cd /d D:\ | D:\ | /d switches the drive |
| cd D: | Shows the current directory on drive D | A drive letter alone only displays it, per Microsoft |
| cd .. | C:\ | Parent folder |
What do the parts of a cd command mean?
Each piece of the syntax has one job.
| Part | Meaning |
|---|---|
| /d | Changes the current drive as well as the current directory |
| <drive>: | The drive to display or change to, if it differs from the current drive |
| <path> | The directory you want to display or change to |
| .. | The parent folder |
| \ | The root directory of the current drive when used as cd\ |
| /? | Displays help at the command prompt |
Once you know these six pieces, you can build any cd command without memorizing examples.
How to cd into a folder with spaces in its name
With command extensions on, spaces are not delimiters, so a path with spaces can work without quotation marks.
Microsoft lists cd username\programs\start menu and cd "username\programs\start menu" as equivalent.
If command extensions are disabled, quotation marks are required, so wrapping the path in quotes is the safe habit.
How to check which directory you are in
Type cd with no parameters and press Enter.
Command Prompt prints the current drive and directory.
What are pushd and popd and when should I use them?
The pushd command saves your current directory and then changes to the path you give it.
- Type
pushd C:\Windows\System32and press Enter. - Do your work in that folder.
- Type
popdto return to the saved directory.
Each pushd adds a directory to a stack, and each popd removes the top one and returns you to it.
For a network path, pushd temporarily assigns the highest unused drive letter, starting with Z:, and popd removes that assignment.
| Command | What it does | Needs command extensions? |
|---|---|---|
| cd | Changes or shows the current directory | Only for case matching and spaces without quotes |
| pushd | Saves the current directory, then changes directory | Network (UNC) paths need extensions enabled |
| popd | Returns to the last saved directory | Drive-letter cleanup needs extensions enabled |
Does cd care about upper and lower case?
With command extensions on, Microsoft says the directory is converted to match the case on disk.
So typing cd c:\temp sets the directory to C:\Temp if that is how it is written on disk.
Example: moving through folders step by step
This sequence starts at C:\Users and ends on another drive.
- Type
cd Publicto move into C:\Users\Public. - Type
cd ..to go back up to C:\Users. - Type
cd\to jump to C:\. - Type
cd /d D:\to switch to the D drive. - Type
cdto confirm where you are.
Each command changes only the current location and does not touch your files.
Which command should I use?
| Situation | Best command | Why |
|---|---|---|
| Folder is inside the current one | cd <folder> | Shortest, uses a relative path |
| Folder is on another drive | cd /d <drive>:<path> | Changes drive and folder together |
| You need to come back afterwards | pushd then popd | Saves and restores your location |
| Folder is on a network share | pushd <UNC path> | Maps a temporary drive letter, starting at Z: |
| You are lost in the folder tree | cd\ | Returns to the root of the current drive |
How to see the built-in help for cd
Type cd /? and press Enter to display help in the window.
Microsoft’s reference uses square brackets to mark optional parts of the syntax, so do not type the brackets themselves.
How to turn command extensions off
Command extensions affect case matching and spaces in cd paths.
- Open a new Command Prompt window.
- Run
cmd /e:offto start a session with extensions disabled. - Quote any path that contains spaces.
Closing that window ends the session and returns you to the normal behavior.
Why does cd not change my drive?
The usual cause is leaving out /d when the target is on another drive.
Run cd /d D:\ and the prompt will switch to the D drive.
Does this work in Windows Terminal and Windows 10?
The cd command is a Command Prompt command, so it behaves the same wherever Command Prompt runs.
Microsoft’s reference lists cd for Windows Server editions and the syntax above is not tied to a Windows 11 menu.
Thank you for writing this! I have a question, Is there a way to add a shortcut to cd to path/1/1/2 to say cd m or cd s? I am wondering if there is a shorter way to do this than typing out the whole path on a windows 11 machine.
Thank you!
That was The most Basic junk I have Ever wasted my time reading. That’s 3rd grade trash. Every time I believe I’m about to find a fix for an NVMe 1Tb Samsung SSD that’s Write Protected, Non-existent in diskpart, and X:sources hold my Win11Pro OS with No Option to access C: since it doesn’t Exist, I get junk like this basic nonsense. I Need someone with a Brain upstairs, Please.