Using cd
/chdir
you cannot change the current working directory (CWD) to one on a different drive unless first switching drives (2 steps) or including the /d
switch as part of your command (1 step).
cd /?
will display the command's help text.
From C:\Users\jessy
to E:\MyData
2 STEPS
1 | C:\Users\jessy> E:
2 | E:\> cd \MyData // also 'cd E:\MyData' & 'cd MyData'
| E:\MyData>
1 STEP
1 | C:\Users\jessy> cd /d E:\MyData
| E:\MyData>
Credit to Señor CMasMas for pointing out the shorter method.
Additional Reading
The way cd
deals with drives and directories reflects its roots in DOS. Windows really only has one current directory, however cmd.exe
uses environment variables tied to that particular session to set and maintain it's own current directory for each drive separate from Windows as well as any other cmd.exe
instances. If you'd like to read more, I have included a few links to get you started.
Other Approaches
pushd
[ credit: user @printf ]