how to change directory using Windows command line

WindowsCommand LineCmdCommand Prompt

Windows Problem Overview


I'm using cmd.exe (C:\WINDOWS\System32\cmd.exe) and I have to change my current directory to "D:\temp" i.e. temp folder in the D drive.

When I try to cd nothing happens.

C:\> cd D:\temp

C:\>

I don't know what else to do here. Even pressing tab key does not give any hints. I have never got the reason to use cmd.exe until now when I have to. I mostly use Linux for development.

If this helps: I'm on a remote login to another computer and D:\temp in on the remote machine, but so is C:\ where I have opened the terminal (cmd.exe).

Windows Solutions


Solution 1 - Windows

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.

Solution 2 - Windows

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

Solution 3 - Windows

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

cd /d d:\temp

( see cd /?)

Solution 4 - Windows

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:

Solution 5 - Windows

You can try this it works for me

C:\Users\user>cd..
C:\Users>cd ..
C:\>D:
D:\>cd \foldername

Solution 6 - Windows

cd /driveName driveName:\pathNamw

Solution 7 - Windows

You can use these three commands: 1.cd.. 2.d: 3.cd temp

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionA. K.View Question on Stackoverflow
Solution 1 - WindowsMark NenadovView Answer on Stackoverflow
Solution 2 - WindowsAnsgar WiechersView Answer on Stackoverflow
Solution 3 - WindowsStephanView Answer on Stackoverflow
Solution 4 - WindowsdanialcodesView Answer on Stackoverflow
Solution 5 - WindowsJannatul FardousView Answer on Stackoverflow
Solution 6 - WindowspushpendraView Answer on Stackoverflow
Solution 7 - WindowsDivyanshuView Answer on Stackoverflow