| |

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

What you wantCommandExample
Go into a foldercd <path>cd Users\Public
Go up one foldercd ..cd ..
Go to the root of the current drivecd\cd\
Switch to a folder on another drivecd /d <drive>:<path>cd /d D:\Projects
Show the current directorycd (no parameters)cd
Go and remember where you werepushd <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

  1. Select Start or the Search icon on the taskbar.
  2. Type cmd.
  3. 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>].

  1. Type cd, a space, then the path of the folder.
  2. Press Enter.
  3. 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.

  1. Type cd /d D:\ and press Enter to switch to the D drive.
  2. 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:\UsersResultWhy
cd PublicC:\Users\PublicRelative path from the current folder
cd /d D:\D:\/d switches the drive
cd D:Shows the current directory on drive DA 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.

PartMeaning
/dChanges 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.

  1. Type pushd C:\Windows\System32 and press Enter.
  2. Do your work in that folder.
  3. Type popd to 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.

CommandWhat it doesNeeds command extensions?
cdChanges or shows the current directoryOnly for case matching and spaces without quotes
pushdSaves the current directory, then changes directoryNetwork (UNC) paths need extensions enabled
popdReturns to the last saved directoryDrive-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.

  1. Type cd Public to move into C:\Users\Public.
  2. Type cd .. to go back up to C:\Users.
  3. Type cd\ to jump to C:\.
  4. Type cd /d D:\ to switch to the D drive.
  5. Type cd to confirm where you are.

Each command changes only the current location and does not touch your files.

Which command should I use?

SituationBest commandWhy
Folder is inside the current onecd <folder>Shortest, uses a relative path
Folder is on another drivecd /d <drive>:<path>Changes drive and folder together
You need to come back afterwardspushd then popdSaves and restores your location
Folder is on a network sharepushd <UNC path>Maps a temporary drive letter, starting at Z:
You are lost in the folder treecd\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.

  1. Open a new Command Prompt window.
  2. Run cmd /e:off to start a session with extensions disabled.
  3. 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.

Official sources

2 Comments

  1. 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!

  2. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *