Cannot change directory (CD) to a directory with space in the name

Page 1 of 2 12 LastLast

  1. Posts : 5
    Windows 7 Pro x64
       #1

    Cannot change directory (CD) to a directory with space in the name


    Following the directions outlined in Change Directory in Command Prompt including enabling command extensions outlined in Command Line does not permit the CD command to change the directory focus to a directory with a space in its name. I am trying to set the active directory prompt to C:\Users\Owner\My Documents. I can get to C:\Users\Owner but with command extensions enabled in administrator mode (CMD E:ON) the CD command will not accept My Documents as a valid directory name within Owner. The error I get is "The system cannot find the path specified." My goal is to get a directory tree (as a file) of the directories and files in My Documents with the DIR command when in that directory. The complete DOS line for that command would read C:\Users\Owner\My Documents>DIR /o:n /s > DirTreeList.txt. Any help would be greatly appreciated.
    Last edited by Brink; 01 Sep 2013 at 12:16. Reason: updated link
      My Computer


  2. Posts : 53,363
    Windows 10 Home x64
       #2

    Welcome to Seven Forums utnatw7f387. I'm far from an expert, but will throw out something simple until the smart people see this. have you tried

    C:\Users\Owner\My\ Documents>DIR /o:n /s > DirTreeList.txt

    A Guy
      My Computer


  3. Posts : 5
    Windows 7 Pro x64
    Thread Starter
       #3

    Guy, I tried your suggestion just to see if the directory focus could be changed to My Documents, but I get the same error mentioned originally. Starting at C:> I can get to C:\Users\Owner> But the CD command cannot find the specified path when I try C:\Users\Owner>cd My\ Documents. Thank you for your suggestion, it was certainly worth a try. Freedom of wind in the face and ears a-flapping - Great sig.
      My Computer


  4. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #4

    Try this command:
    DIR C:\Users\Owner\Documents /o:n /s > DirTreeList.txt
      My Computer


  5. Posts : 5
    Windows 7 Pro x64
    Thread Starter
       #5

    Thank you David, that WORKED! I successfully got the directory list I was after. I will document this solution so I never lose it. Thanks again to you both. I have marked the problem as solved.
      My Computer


  6. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #6

    You're welcome!
    Glad you got it solved.
    :)
      My Computer


  7. Posts : 53,363
    Windows 10 Home x64
       #7

    Good one David. I considered that, but the whole library thing confuses me Glad you got it sorted utnatw7f387. A Guy
      My Computer


  8. Posts : 5
    Windows 7 Pro x64
    Thread Starter
       #8

    I checked and found this solution works for all User directories beginning with My. I also checked to see if it worked for User directory names like Saved Games, Start Menu, & Virtual Machines. In those cases, the full name with the space is accepted by the CD command. There is nothing quite as nice as consistency and adequate documentation of odd features, is there? I don't have a need for directory lists for system directories not related to a user, but it would be nice to know if this solution will work in those cases, too. Thanks again to both of you, you saved my day. Any further thoughts guys?
      My Computer


  9. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #9

    The problem is with Win 7 "My Documents" is a Junction Point, and the directory (folder) name is Documents.
    Yup, it makes it confusing because you see "My Documents" in Windows Explorer.
    But, if you do a DIR command in a CMD window you will see "Documents" as the folder name in your User directory.
      My Computer


  10. Posts : 5
    Windows 7 Pro x64
    Thread Starter
       #10

    Thanks Dave, I think that clears this up quite a bit. In the meantime I checked some other directory names with spaces and the CD command accepts them all. I hate to keep asking questions, but are there other Junction Point situations other than those we see as My ...?
    BTW are you aware of this odd but useful undocumented feature?
    The "Include subfolders in search results..." switch in WE Tools > Folder Options > Search > How to search behaves differently for the two My Documents access points. Searches under Desktop > Libraries > Documents > My Documents always searches all sub-folders independent of this switch. That's probably a good idea for users who have no idea where their lost files might be. But, searches in C:\Users\Owner\Documents respond to the switch setting. That's kind of handy if you have a better idea of where your lost files might be located. Accident or deliberate, it's kind of a neat feature to know about.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 00:40.
Find Us