Why is cd in Windows not able to switch between drives?
This is by design. Each "drive" has it's own working directory. You can use chdir
, or you can simply type the drive letter:
> D:
And that will change to the D drive. If you want to know why this behavior exists, see Raymond Chen's Explanation
In windows could use the native cd/d <drive>:<path>
or else chdir/d
or pushd
. It is the /d
option that indicates that the drive should change as well. The pushd
command does this by default.
Can even alias cd to make that the default behavior like so:
doskey cd=chdir/d $*
Then can use do things like:
cd D:\Temp
cd C:\WINDOWS
and the drive will change as well.
See the help by entering cd/?
for more details.
It's a historical thing. cd
only changes current directory on the drive that is specified (current if none), and <drive>:
changes drives to the folder on that drive which was cd
'd earlier (\
if none)