how to change directory using Windows command line
cd
has a parameter /d
, which will change drive and path with one command:
cd /d d:\temp
( see cd /?
)
Another alternative is pushd
, which will automatically switch drives as needed. It also allows you to return to the previous directory via popd
:
C:\Temp>pushd D:\some\folder
D:\some\folder>popd
C:\Temp>_
The "cd" command changes the directory, but not what drive you are working with. So when you go "cd d:\temp", you are changing the D drive's directory to temp, but staying in the C drive.
Execute these two commands:
D:
cd temp
That will get you the results you want.
Just type your desired drive initial in the command line and press enter
Like if you want to go L:\\ drive,
Just type L: or l: