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

Quick Answer: To change to a different drive in the command line, you typically just type the drive letter followed by a colon and press Enter. For example, to switch to the D: drive, you would type `D:` and press Enter.

Key Facts

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:

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 Projects

If 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:

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:

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/MyUSB

If you wanted to go into a specific folder named 'Photos' on that USB drive, you would:

cd /media/youruser/MyUSB/Photos

Finding Mount Points:

If you're unsure where a drive is mounted, you can use commands like:

Once you identify the correct path, you use `cd` to navigate to it, just like any other directory.

Troubleshooting Common Issues

Mastering these commands allows for efficient file management directly from the command line, a skill valuable for system administrators, developers, and power users.

Sources

  1. Command-line interface - WikipediaCC-BY-SA-4.0
  2. Command Prompt commands - Windows commands | Microsoft Learnfair-use
  3. cd(1) - Linux man pagefair-use

Missing an answer?

Suggest a question and we'll generate an answer for it.