How7o
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: How to cd to a Different Drive in Windows
Share
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > OS > How to cd to a Different Drive in Windows
OS

How to cd to a Different Drive in Windows

how7o
By how7o
Last updated: May 22, 2026
4 Min Read
cd to a different drive in Windows — D: vs cd /d D:path
SHARE

To cd to a different drive on Windows, use either the bare drive letter (D:) or cd /d D:\path. Plain cd D:\ doesn’t switch drives — it silently updates D:’s remembered directory without leaving C:. The /d flag tells cd to change both the drive and the directory.

Contents
  • TL;DR
  • The drive-letter shortcut
  • Switch drive AND directory in one shot
  • PowerShell users — ignore all of this
  • Frequently asked questions
  • Related guides
  • References

Last verified: 2026-05-17 on Windows 11 cmd. Originally published 2022-09-30, rewritten and updated 2026-05-17.

TL;DR

:: Just switch drives, keep D:'s current directory
D:

:: Switch drive AND change directory in one go
cd /d D:\projects\site

:: cmd doesn't switch drives without /d — this is a no-op
cd D:\

The drive-letter shortcut

The fastest way to switch is to type the drive letter followed by a colon, with nothing else:

C:\Users\you> D:
D:\projects\site>

cmd switches to D: and resumes whatever directory was last current on that drive. Each drive has its own “current directory” — try cd on its own to see what cmd thinks the current directory is on the new drive.

cd to different drive Windows — D: switches drive, cd /d switches both drive and directory

Switch drive AND directory in one shot

cd /d D:\projects\site

The /d flag is the only way to change both in a single cd call. Without it, cmd silently does nothing visible — exactly the behavior that trips everyone up the first time.

PowerShell users — ignore all of this

PS C:\Users\you> cd D:\projects\site
PS D:\projects\site>

PowerShell’s cd (alias for Set-Location) handles cross-drive changes natively. The /d dance only applies to classic cmd.

Frequently asked questions

Why doesn’t cd D:\ work in Windows?

Because plain cd in cmd only changes the directory on the current drive. Typing cd D:\ while sitting on C: changes what cmd remembers as D:’s current directory, but the prompt stays on C:. To actually switch drives, you either type the drive letter alone (D:) or use cd /d D:\path.

What does the /d flag do?

It tells cd to change both the drive and the directory in one command. cd /d D:\projects\site drops you straight into that path on D: regardless of which drive you started on. Without /d, cmd only changes the directory and prints nothing — a silent no-op that confuses everyone the first time.

Does PowerShell behave differently?

Yes — PowerShell’s Set-Location (alias cd) handles cross-drive changes natively: cd D:\projects works without any extra flag. The /d trick is a cmd-specific workaround. If you’re using PowerShell, just cd normally.

Can I jump to a drive that doesn’t exist or has no media?

No — cd /d X:\ with no drive X mounted returns The system cannot find the path specified. Useful as a quick check that a USB stick or network drive is actually mapped before scripts assume it’s there.

What about navigating UNC paths (network shares)?

cd by itself can’t make UNC paths (\\server\share) the current directory in cmd — that’s a long-standing cmd limitation. Workarounds: map the share to a drive letter first (net use Z: \\server\share) then cd /d Z:\, or use PowerShell where Set-Location \\server\share just works.

Related guides

  • How to Access MySQL from Command Line in XAMPP on Windows
  • Auto-start Apache and MySQL with XAMPP on Windows

References

Microsoft Learn — cd command: learn.microsoft.com/en-us/windows-server/administration/windows-commands/cd.

TAGGED:configurationwindows

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article Break out of a jQuery .each() loop with return false How to Break Out of a jQuery .each() Loop
Next Article CSS checkbox background color — accent-color one-liner and hide-and-replace fallback How to Change a Checkbox Background Color with CSS
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

FacebookLike
XFollow
PinterestPin
InstagramFollow
Most Popular
Run Laravel queue workers with Supervisor
How to Run Laravel Queue Workers in Production with Supervisor
May 23, 2026
Nginx as a reverse proxy for a Node.js app on Ubuntu
How to Set Up Nginx as a Reverse Proxy for Node.js on Ubuntu
May 23, 2026
Install and configure Redis on Ubuntu for Laravel and WordPress
How to Install and Configure Redis on Ubuntu (for Laravel & WordPress)
May 23, 2026
Harden a fresh Ubuntu VPS with UFW, Fail2Ban, and SSH key auth
How to Harden a Fresh Ubuntu VPS: UFW + Fail2Ban + SSH Key Auth
May 23, 2026
Set up Let's Encrypt SSL with Certbot on Ubuntu
How to Set Up Let’s Encrypt SSL with Certbot on Ubuntu (Apache & Nginx)
May 23, 2026

You Might Also Like

Nginx subdirectory configuration with alias and PHP-FPM
Server Management

How to Configure Nginx for a Subdirectory

5 Min Read
Linux add and delete users from the terminal — adduser, passwd, sudo group, userdel
Server Management

How to Add and Delete Users on a Linux Server from the Terminal

7 Min Read
Diagnose MySQL 100% CPU usage with PROCESSLIST and INNODB STATUS
Server Management

How to Find What’s Pinning MySQL at 100% CPU

6 Min Read
Check Linux OS name and version from the command line
Server Management

How to Check the Linux OS Name and Version from the Command Line

4 Min Read
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Tools

  • Age Calculator
  • Word Counter
  • Image Upscaler
  • Password Generator
  • QR Code Generator
  • See all tools→

Pranks

  • Fake Blue Screen Prank
  • Hacker Typer
  • Fake iMessage Generator
  • Windows XP Crash Prank
  • Windows 11 Update Prank
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?