Timeline for CMD cd to other drives except C:\ not working
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 11, 2022 at 19:00 | comment | added | user124 | @Synetech a bit funny of course, but there is a slight ambiguity in answer, because OP asked for drive d, and flag used is also /d. Changing (or adding) example to something like "cd /d z:\path\to\dir\on\drive\z" would help some heisty folks. | |
Sep 20, 2019 at 12:57 | comment | added | Larry Lo | I have just done a scratch search for this and tried | |
Sep 20, 2019 at 12:47 | comment | added | Synetech | @RajuyourPepe, Yes. I agree. In fact, I agree so much, I agreed with you almost 8.5 years in advance, in anticipation of your comment. | |
Sep 19, 2019 at 9:45 | comment | added | Larry Lo | cd /d "D:\abc\your_directory" | |
Jun 28, 2011 at 0:46 | comment | added | Synetech | Ah, see Raymond says the same thing in the blog entry that HalloDu links to above. | |
Jun 28, 2011 at 0:35 | comment | added | Synetech |
That works because the CD command expects a single path argument (it does not take multiple directories). Therefore it interprets everything (other than the /d switch) as a single path, including spaces. That’s why if you use the auto-completion character (defaults to TAB) with CD , it only selects directories, while with other commands (eg dir , copy , etc.), it selects files and directories together. Like DMA57361 said, CD knows what it does and understands its arguments, so it handles them— or rather it —intelligently. (Were that all programs would do so. *sigh*)
|
|
Jun 27, 2011 at 10:23 | comment | added | DMA57361 |
@Liu, you don't always need to bother, for example cd /d C:\program files\Microsoft Office works fine for me from D: on a Win XP cmd instance. It is however, a really good habit to get in to, otherwise one day you'll use another application that cannot handle paths given as arguments that aren't enclosed.
|
|
Jun 26, 2011 at 19:27 | comment | added | LiuYan 刘研 |
And, don't forget put " around path if there are spaces in it: cd "D:\My Documents\My Music\A Band\An Album"
|
|
Jun 26, 2011 at 19:04 | history | answered | Synetech | CC BY-SA 3.0 |