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
Laravel Eloquent ORM — a model class mapping to a database table with query methods
Laravel Eloquent ORM: The Complete Guide to Querying Your Database
June 16, 2026
Set vi as the default editor in Ubuntu — a terminal opening the vim editor
How to Set vi (Vim) as the Default Editor in Ubuntu
June 8, 2026
rsync says ALL DONE but files are missing — a terminal showing ALL DONE next to an empty folder
rsync Says “ALL DONE” but Files Are Missing: How to Verify
June 8, 2026
Migrate a website to a new server with rsync — files copying from an old server to a new one over SSH
How to Migrate a Website to a New Server With rsync
June 8, 2026
Bun runtime — faster JS toolkit replacing npm in Laravel projects
How to Install Bun Runtime on Ubuntu (And Use It in a Laravel Project)
May 24, 2026

You Might Also Like

Cloudflare Tunnel — outbound-only connection from server, no inbound port forward
Server Management

How to Install Cloudflare Tunnel on Ubuntu (Expose Local Services, No Port Forwarding)

9 Min Read
Comment in a .gitignore file with the # character
Web Development

How to Comment in a .gitignore File

4 Min Read
Fix broken cPanel disk quotas with the fixquotas script
Server Management

How to Fix Quotas in cPanel

5 Min Read
Completely remove MariaDB from a RHEL-family server
Server Management

How to Remove MariaDB Completely from RHEL/CentOS

5 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?