A. K.
A. K.

Reputation: 38106

how to change directory using Windows command line

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).

Upvotes: 274

Views: 1180684

Answers (10)

armagedescu
armagedescu

Reputation: 2160

A powerful thing is the help provided by the command itself. cd /? will output some useful information about cd. enter image description here

The argument /D will change directory and drive, if specified in the path. Single command, no workaround:

cd /D path

Upvotes: 1

Rishi Agrahari
Rishi Agrahari

Reputation: 19

Need to move from one directory or folder to another just do this:

Here is the folder structure as- Folder structure

And this is works for me -- Enter the command --

D:\CipharByteIntern\Razorpay\razorpay_frontend> cd ../..\CBTCIP\EventPlanner360

-- Navigated folder ---

D:\CipharByteIntern\CBTCIP\EventPlanner360>

Upvotes: 1

Munna Kumar
Munna Kumar

Reputation: 535

Use Command

To Move to D Drive

G:\ D:         

To Move to temp Folder

D:\ cd temp      

Upvotes: 9

Jannatul Fardous
Jannatul Fardous

Reputation: 69

You can try this it works for me

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

Upvotes: 5

Divyanshu
Divyanshu

Reputation: 1

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

Upvotes: -4

pushpendra
pushpendra

Reputation: 13

cd /driveName driveName:\pathNamw

Upvotes: -2

danialcodes
danialcodes

Reputation: 183

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:

Upvotes: 1

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200193

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

Upvotes: 164

Stephan
Stephan

Reputation: 56155

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

cd /d d:\temp

( see cd /?)

Upvotes: 152

Mark Nenadov
Mark Nenadov

Reputation: 6907

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.

Upvotes: 466

Related Questions