Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 7
    And, don't forget put " around path if there are spaces in it: cd "D:\My Documents\My Music\A Band\An Album" Commented Jun 26, 2011 at 19:27
  • 3
    @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.
    – DMA57361
    Commented Jun 27, 2011 at 10:23
  • 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*)
    – Synetech
    Commented Jun 28, 2011 at 0:35
  • Ah, see Raymond says the same thing in the blog entry that HalloDu links to above.
    – Synetech
    Commented Jun 28, 2011 at 0:46
  • 1
    cd /d "D:\abc\your_directory"
    – Larry Lo
    Commented Sep 19, 2019 at 9:45