C:\Users\vk Yadav>cd d:
D:\
C:\Users\vk Yadav>
Why it's happening?
C:\Users\vk Yadav>cd d:
D:\
C:\Users\vk Yadav>
Why it's happening?
cd
means change directory. You don't use it to change drives. Typing cd D:
tells you what the current directory is on drive D:
.
To change drives, just type the new drive letter followed by :, as in D:
and hit Enter.
To learn what cd
does, type cd /?
at a command prompt.
Reading cd /?
help shows you that when changing directories to different drives requires /d
option.
cd /d D:\
but using
cd /d D:
will only change to the drive with previous path, similar as standalone D:
command
The command obviously works with appended folders.
cd /d "D:\Some Folder\"
If you only want to changes drives, then just doing
D:
Will change to the drive. But if you were in a specific directory on D:
prior to swopping to C:\
then running D:
will land you back in that dir. The following demonstrates this, you can test it yourself by copying it, add an actual directory name where I have Some Folder
and paste into your cmd
window.
echo off & cls
cd "%userprofile%"
cd
cd /d "D:\Some Folder\"
cd
D:
cd
C:
cd
cd /d D:
cd
cd /d C:
cd
cd /d D:\
cd
cd /d C:\
cd
Running the above on my system (note I use Z:\
instead of D:\
)
So if you intend to only land exactly on the drive or drive\dir, then just use cd /d path