How to cd to a different drive
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 4, 2026
Key Facts
- In Windows Command Prompt or PowerShell, typing the drive letter followed by a colon (e.g., `C:`, `D:`) switches the current directory to the root of that drive.
- This command works for any accessible drive, including internal hard drives, SSDs, USB drives, and network drives.
- Once you've switched drives, subsequent commands like `cd` will operate within that new drive's file system.
- This method is a fundamental command for navigating file systems in command-line interfaces.
- On Linux or macOS, drives are mounted to specific directories, so you use the `cd` command with the mount point path (e.g., `cd /mnt/usb_drive`).
Overview
Navigating your computer's file system is a common task, and often you need to work with files on different storage devices or partitions. When using a command-line interface (CLI), such as the Command Prompt or PowerShell in Windows, or the Terminal in Linux and macOS, you use specific commands to change your current working directory. One frequent requirement is to switch to a different drive. This is particularly relevant in Windows, where drives are typically lettered (C:, D:, E:, etc.), and in Linux/macOS, where external drives are mounted to specific directories within the main file system.
Changing Drives in Windows (Command Prompt & PowerShell)
In Windows, drives are usually assigned letters. The default drive is typically C:. If you have other drives, such as a secondary internal drive (D:), an external USB drive, or a DVD drive, you can switch to them directly from the command line.
The Command:
To change to a different drive, you simply type the drive letter followed by a colon and press Enter. For example:
- To switch to the D: drive, type:
D:and press Enter. - To switch to the E: drive, type:
E:and press Enter.
Once you execute this command, your command prompt will update to indicate that you are now working on the specified drive. For instance, if you were on C:\Users\YourName> and you typed D:, the prompt might change to D:\>, indicating you are now at the root of the D: drive.
Changing Directories within a Drive:
After switching to a new drive, you can use the standard `cd` (change directory) command to navigate to specific folders on that drive. For example, if you've switched to the D: drive and want to go to a folder named 'Projects', you would type:
cd ProjectsIf you want to go to a specific path like 'D:\Documents\Work', you can combine the drive switch and the path change, although it's often clearer to do it in two steps:
- Step 1:
D: - Step 2:
cd Documents\Work
Alternatively, you can sometimes specify the full path including the drive letter with the `cd` command, but this behavior can vary slightly between shells (Command Prompt vs. PowerShell) and versions. The most reliable method is the two-step process: first, switch the drive, then navigate within it.
Changing Drives in Linux & macOS
Linux and macOS use a different system for managing storage devices. Instead of drive letters, all storage devices (internal hard drives, SSDs, USB drives, network shares) are 'mounted' to specific directories within a single, unified file system hierarchy, typically starting from the root directory (/).
Understanding Mount Points:
When you plug in a USB drive or connect to a network share, the system mounts it to a designated directory. Common mount points include:
/media/username/drive_name(for removable media)/mnt/drive_name(a traditional location for temporary mounts)/Volumes/drive_name(on macOS)
The Command:
To change to a different 'drive' (which is actually a mounted file system), you use the standard `cd` command, specifying the path to the mount point.
For example, if your USB drive is mounted at /media/youruser/MyUSB, you would navigate to it like this:
cd /media/youruser/MyUSBIf you wanted to go into a specific folder named 'Photos' on that USB drive, you would:
cd /media/youruser/MyUSB/PhotosFinding Mount Points:
If you're unsure where a drive is mounted, you can use commands like:
lsblk(Linux) - Lists block devices and their mount points.df -h(Linux & macOS) - Shows disk space usage and mount points for all mounted file systems.mount(Linux & macOS) - Displays all currently mounted file systems.
Once you identify the correct path, you use `cd` to navigate to it, just like any other directory.
Troubleshooting Common Issues
- Drive Not Appearing: If a drive doesn't show up in Windows (e.g., as D:), it might not be formatted or assigned a letter. You can use Disk Management (
diskmgmt.msc) to check and assign a letter. In Linux/macOS, ensure the drive is properly connected and mounted. - Permissions Errors: Sometimes you might encounter permission denied errors when trying to access a drive or directory. This usually requires administrative privileges or adjusting file permissions.
- Incorrect Path: Double-check the drive letter or mount point path for typos.
Mastering these commands allows for efficient file management directly from the command line, a skill valuable for system administrators, developers, and power users.
More How To in Daily Life
Also in Daily Life
More "How To" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
Missing an answer?
Suggest a question and we'll generate an answer for it.