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:\

Every time I want to change directory context to another drive (D, E, F, or whatever..) on a Windows command-prompt, I must use "Drive letter":\ command to actually change it. If I try with "cd command" on cd H:\ it just echo H:\ for me and do nothing:

Enter image description here

Is there some reason for such a behavior? I mean, shoudn't cd command work to do this? Why does't it?

share|improve this question

marked as duplicate by Oliver Salzburg, Daniel Beck, slhck, Peter Mortensen, haimg Apr 16 '12 at 19:29

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.

2  
Related. –  Daniel Beck Apr 16 '12 at 18:04

3 Answers 3

up vote 8 down vote accepted

Try:

cd /d d:

/d will also switch drive letters as well as directories, for other information, see cd /?

share|improve this answer
1  
Looks like cmd.exe mimics the behavior of DOS pretty well in this situation, whereby the "current directory" for each drive is remembered distinctly. –  ultrasawblade Apr 16 '12 at 17:36
2  
This is the real answer to "why Widows works this way": because DOS did it that way. –  Michael Edenfield Apr 16 '12 at 18:00

The straight-forward answer is that "because it is not written to work that way". Simply entering D: will do what you want.

Curiously entering cd D:\somedir will, in fact, change the current directory on D: to \data, but will not change the current command prompt to D:.

share|improve this answer

The reason Windows behaves this way, is because DOS behaved that way.

In DOS, each drive has its own current directory, and the cd command changes the current directory on a drive. If that also happens to be the current drive, then your working directory changes along with it. If you want to change the current drive, you simply specify the drive letter as a command.

Notes that Windows doesn't actually work this way anymore -- you only have one current directory at any time -- but the command shell goes to great lengths to pretend that there are still per-drive current directories. Presumably this is to preserve compatibility with existing DOS batch files.

The reason DOS works this way dates back to the very earliest versions of DOS, and CP/M before it. The gory details can be found on Raymond Chen's blog.

share|improve this answer

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