The cd command switches you between drives and folders

To change drives in Command Prompt, type cd followed by the drive letter and a colon, then press Enter. For example, to switch from your C: drive to your D: drive, type cd D: and press Enter. The prompt will update to show you are now on the D: drive.

If you want to change to a specific folder on a different drive at the same time, type the full path: cd D:\Users\Documents. Command Prompt will move you to that location in one step. If the folder path contains spaces, wrap the entire path in quotation marks: cd "D:\Program Files\My Folder".

You can also use cd .. to move up one folder level, or cd \ to jump to the root of your current drive. The dir command shows you what folders and files exist in your current location, which helps you navigate to the right place.

Key Takeaways

  • Type cd D: to switch to a different drive, replacing D with your target drive letter.
  • Use cd D:\folder\subfolder to change drives and navigate to a specific folder in one command.
  • Wrap folder paths in quotation marks if they contain spaces: cd "D:\Program Files".
  • The dir command lists the contents of your current location so you know which folders to navigate to.
  • Use cd .. to move up one level or cd \ to return to the root of your current drive.

Switching between drives on the same computer

When you open Command Prompt, you start on your C: drive by default. If your computer has multiple drives — such as a D: drive, external USB drive, or network location — you can move between them using the cd command with just the drive letter.

Type cd E: to move to your E: drive, or cd F: for your F: drive. Each drive on your system has its own letter. After you press Enter, the command prompt will show the new drive letter, confirming you have switched. You can now run commands and view files on that drive.

If a drive is not connected or does not exist, Command Prompt will show an error message like "The system cannot find the path specified." Check that the drive letter is correct and that the drive is physically connected or mounted.

Navigating to folders on a different drive

You can change drives and move into a specific folder at the same time by typing the full path. For example, cd D:\Users\Downloads switches to the D: drive and opens the Downloads folder in one command. This is faster than switching drives first and then navigating folder by folder.

If your folder path includes spaces — such as D:\Program Files\My Application — you must put the entire path in quotation marks: cd "D:\Program Files\My Application". Without the quotes, Command Prompt will stop reading the path at the first space and show an error.

To see what folders exist before you navigate, use the dir command on the target drive. For example, type cd D: first, then type dir to list all folders and files on that drive. This helps you find the exact path you need.

Moving up and down the folder structure

Once you are inside a folder, you can move to parent folders or subfolders without typing the full path. The cd .. command moves you up one level. If you are in D:\Users\Documents\Work, typing cd .. takes you to D:\Users\Documents.

To move to the root of your current drive, type cd \. This takes you to the top level, such as D:\, no matter how deep you are in the folder structure. You can then navigate down into a different folder path from there.

Typing cd by itself shows you the current folder path. This is useful if you have navigated several levels deep and need to confirm where you are before running a command.

Checking what is on each drive

Before you navigate to a drive, you may want to see what folders and files it contains. The dir command lists everything in your current location. If you are on the C: drive and want to see what is on the D: drive without switching to it first, type dir D:.

The output shows folder names, file names, file sizes, and the date each item was last modified. Folders are marked with <DIR> so you can tell them apart from files. This helps you find the exact folder path you need before you use the cd command to navigate there.

You can also use dir /s to search through all subfolders at once, though this can produce a long list. For a cleaner view, type dir /b to show only names without the extra details.

Handling special cases and common errors

If you type a drive letter that does not exist, such as cd Z: on a computer with no Z: drive, Command Prompt will show "The system cannot find the path specified." Check that the drive is connected and that you typed the letter correctly.

If you type a folder path that does not exist, you will see the same error. Use dir to confirm the exact spelling and structure of the folder before you try to navigate to it. Folder names are case-insensitive in Command Prompt, so cd downloads and cd Downloads both work the same way.

Network drives mapped to your computer also have drive letters and work the same way. If your network drive is mapped as Z:, you can type cd Z: just like any other drive. If the network connection drops, Command Prompt will show an error when you try to access it.

Frequently Asked Questions

Can I change drives without using cd?

Yes. You can type just the drive letter followed by a colon, such as D:, and press Enter. This switches you to that drive without the cd command. However, cd D: is more explicit and works the same way, so either method is fine.

What if my external USB drive does not show up as a drive letter?

External drives sometimes appear as folders inside another drive rather than as their own drive letter. Check File Explorer to see how your USB drive is labeled. If it shows as a folder path like D:\USB Drive, use cd "D:\USB Drive" instead of trying to switch to a separate drive letter.

How do I go back to the C: drive from another drive?

Type cd C: and press Enter. You will return to your C: drive. If you want to go to a specific folder on C:, type the full path: cd C:\Users\Documents.

Can I use forward slashes instead of backslashes in paths?

Yes. Command Prompt accepts both cd D:/Users/Documents and cd D:\Users\Documents. Backslashes are the Windows standard, but forward slashes work too.

What does "access denied" mean when I try to change folders?

It means you do not have permission to open that folder. You may need to run Command Prompt as administrator, or the folder may be restricted by your system. Right-click Command Prompt and select "Run as administrator" to try again.