The command to change drives is a single letter followed by a colon
To move from one drive to another in Command Prompt, type the drive letter followed by a colon and press Enter. If you are on C: and want to go to D:, you type D: and press Enter. That is the entire command — Command Prompt will then show you the D: prompt, and any commands you run will affect files on that drive instead.
This works for any drive your computer recognizes: external hard drives, USB flash drives, SD cards, or network drives that have been assigned a letter. The command fails silently if the drive does not exist or is not currently connected, so Command Prompt will simply stay on your current drive and show the prompt again.
You can verify which drive you are on by looking at the prompt itself. It always shows the current drive letter at the start — C:\Users\YourName> means you are on the C: drive, while E:\> means you are on the E: drive.
Key Takeaways
- Type the drive letter followed by a colon (for example, D:) and press Enter to switch drives in Command Prompt.
- The prompt display always shows which drive you are currently on at the beginning of the line.
- External drives, USB flash drives, and network drives work the same way as internal drives once they have been assigned a letter.
- If the drive does not exist or is not connected, the command does nothing and you remain on your current drive.
How to find out what drives are available
Before you switch to a drive, you need to know what letter it has been assigned. The fastest way is to type wmic logicaldisk get name and press Enter. This shows a list of all drives your computer recognizes, each with its letter.
Another method is to type diskpart and press Enter, then type list disk. This shows physical drives rather than logical partitions, so it is more useful if you are working with multiple partitions on a single physical drive. Type exit to leave diskpart and return to the regular Command Prompt.
You can also open File Explorer (the folder icon on your taskbar) and look at the left sidebar under "This PC" — every drive your computer has will be listed there with its letter. This is the simplest method if you are not comfortable with command-line tools yet.
Switching between drives when you have a folder open
If you are currently inside a folder on the C: drive and you type D:, Command Prompt switches to the D: drive but stays in the root directory (the top level). You will see D:\> as your prompt, not D:\Users\YourName> or whatever folder you were in on C:.
To switch drives and stay in the same folder path, use cd /d D:\Users\YourName instead. The /d flag tells Command Prompt to change both the drive and the directory at the same time. Without it, cd alone cannot move you between drives.
For example, if you have a folder called Projects on both your C: and E: drives and you want to move to the E: version while keeping the same path, type cd /d E:\Projects and press Enter.
Why a drive might not appear or might become unavailable
External drives and USB flash drives only show up in Command Prompt if they are physically connected and powered on. If you unplug a USB drive or turn off an external hard drive, that drive letter disappears. If you try to switch to it, Command Prompt will not respond to the command and will stay on your current drive.
Network drives (drives shared by another computer on your network) must be mapped first before they appear as a drive letter. Mapping is done through File Explorer: right-click "This PC" in the sidebar, select "Map network drive", choose a letter, and enter the network path. Once mapped, you can switch to it in Command Prompt the same way you would any other drive.
Some external drives are formatted in a way that Windows does not recognize, or they may have failed. If a drive is not showing up even though it is plugged in, check File Explorer first — if it does not appear there either, the drive may need to be reformatted or repaired.
Common mistakes when switching drives
The most common error is typing the drive letter without the colon. D alone will not work — it must be D: with the colon. Command Prompt will treat D as a command name and tell you it does not recognize it.
Another mistake is assuming you can use a drive letter that has not been assigned. If your computer only has C: and D: drives, typing E: will not create a new drive or switch to anything — it will simply fail and leave you on your current drive.
If you are trying to switch drives while inside a batch file or script, remember that each line runs in sequence. If you type D: on one line and then a command on the next, the command will run on the D: drive. But if you close the script or batch file, you will return to whatever drive you started on — the drive change does not persist after the script ends.
Using drive letters in file paths
You do not always have to switch drives to work with files on another drive. You can reference a file on D: while you are on C: by typing its full path. For example, dir D:\Documents will list the contents of the Documents folder on D: even if you are currently on C:.
This is useful when you want to run a single command on another drive without switching. If you need to run many commands on that drive, switching with D: is faster than typing the full path each time.
Frequently Asked Questions
What if I type a drive letter and nothing happens?
The drive either does not exist, is not connected, or is not assigned a letter. Check File Explorer to see what drives are available. If the drive appears in File Explorer but not in Command Prompt, try unplugging and reconnecting it, or restart Command Prompt and try again.
Can I switch to a drive that is currently in use by another program?
Yes. Switching drives in Command Prompt does not lock or interfere with other programs using those drives. You can be on D: in Command Prompt while another program is reading or writing files on D: at the same time.
Do I need administrator rights to switch drives?
No. Switching drives requires no special permissions. However, some operations you perform on a drive (like deleting system files or formatting) may require administrator rights. Opening Command Prompt as administrator is only necessary for those specific tasks.
Will switching drives in Command Prompt affect my files?
Switching drives alone does nothing to your files. It only changes which drive your commands run on. Your files are not affected unless you run a command that modifies them, like del or format.