20

Possible Duplicate:
Using cd Command in Windows Command Line, Can’t Navigate to D:\
CMD cd to other drives except C:\ not working

I am working with cmd.exe on Windows 7 (as opposed to Powershell). I have 2 partitions on my drive, C contains the OS and installed programs, and D contains my data. I was trying to cd from C to D, but cmd wouldn't let me:

C:\>cd D:\

C:\>

However, when I type dir D:\, it will list the contents of D correctly. Why does it do this and how can I fix it? Powershell works fine so I can use that, but I would like to know what makes cmd misbehave.

astay13
  • 333

3 Answers3

33

You have to use just d: , not cd d:\

EDIT: it is also possible to use cd /d d: to change drives using cd

soandos
  • 24,600
  • 29
  • 105
  • 136
28

Windows tracks a separate working directory for each drive. You are currently on the 'C' drive in the working directory '\'. When you type cd d:\ it changes your working directory for the 'D' drive to '\' and has no effect on your C drive working directory. To change drives, just type D:. You can change both at the same time with the /d parameter to cd.

1

It should be noted that pushd (e.g. pushd D:\) will always change drives.

bobbymcr
  • 2,212