Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Using cd Command in Windows Command Line, Can’t Navigate to D:\

Why, just why, is cd in Windows so stupid and does not do what it's supposed to do in the situations like this:

I:\Documents and Settings\blah\>cd C:\somedir\
I:\Documents and Settings\blah\>

I know you can chdir /d. But why is that not the default behavior?

share|improve this question

marked as duplicate by Synetech, ÃŁŁǫǛȉЖΦΤїҪ, 8088, DragonLord, Nifle Dec 1 '12 at 10:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@kinokijuf: don't edit the tags if you don't know what they mean. –  houbysoft Feb 15 '12 at 18:34
    
I don't agree this is a duplicate. The "duplicate" asks how, not why. –  vcsjones Jul 12 '13 at 0:34

4 Answers 4

up vote 18 down vote accepted

This is by design. Each "drive" has it's own working directory. You can use chdir, or you can simply type the drive letter:

> D:

And that will change to the D drive. If you want to know why this behavior exists, see Raymond Chen's Explanation

share|improve this answer
    
As the blog says, s/has/used to have/, and the cmd shell emulates this behavior. –  grawity Dec 26 '10 at 11:00
    
Basically, because cd is change directory, not change drive. –  Rob Feb 15 '12 at 19:09

In windows could use the native cd/d <drive>:<path> or else chdir/d or pushd. It is the /d option that indicates that the drive should change as well. The pushd command does this by default.

Can even alias cd to make that the default behavior like so:

doskey cd=chdir/d $*

Then can use do things like:

cd D:\Temp
cd C:\WINDOWS

and the drive will change as well.

See the help by entering cd/? for more details.

share|improve this answer

It's a historical thing. cd only changes current directory on the drive that is specified (current if none), and <drive>: changes drives to the folder on that drive which was cd'd earlier (\ if none)

share|improve this answer

some 3rd party shells - like 4dos has CDD command for this

You can create a batch file called "cdd.bat" in your main Windows directory with the following line:

@cd /d %1 %2 %3 %4 %5 %6 %7 %8 %9

Now, you can do the following with the new CDD command:

C:>cdd d:

D:>cdd c:\documents and settings

C:\Documents and Settings>cdd d:\data

D:\data>

share|improve this answer
    
How about @cd /d %* –  grawity Dec 26 '10 at 11:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.