how to change directory using Windows command line how to change directory using Windows command line windows windows

how to change directory using Windows command line


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.


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>_


cd has a parameter /d, which will change drive and path with one command:

cd /d d:\temp

( see cd /?)