Why can’t you type `C:foldersubfolder` into Run box?

Posted on

QUESTION :

I stumbled across these apparent inconsistencies long ago but never came to an acceptable explanation about how it all worked. All of these can be typed into the Start > Run box on Windows XP.

  1. C:folder (with no backslash) works.

  2. C:Documents and Settings<username> works.

  3. Yet, why doesn’t C:foldersubfolder work?

  4. Note that C:folder..foldersubfolder does work when it seems to be logically equivalent.

I found this, but it provides an explanation for why it should work…
http://en.wikipedia.org/wiki/Path_(computing)#MS-DOS/Microsoft_Windows_style

ANSWER :

I just tested it and it worked fine. The biggest thing you need to check is the current directory explorer is using. It should be your home directory (in my case here at work it is H:).

In order for the C:foldersubfolder syntax to work, folder must be under the current working directory for explorer.

In my case, I have H:tests, H:tests200930, and H:tests200940 and running

H:tests200940

worked as expected.

I guess you need to make sure that subfolder is there and that foldersubfolder is under your working directory for explorer.

You can view the current directory for explorer using the Process Explorer tool from Sysinternals. Once you run Process Explorer, find Explorer.exe, double click on it, and look at the current directory.

You can actually confirm this behavior yourself by using the command prompt and trying the following (note, you’ll need at least two drives to test this)

H:> dir
...
Directory of H:
2009-08-26  09:13    <DIR>          Tests
...
H:> cd Tests
H:Tests> c:
C:> dir H:
...
Directory of H:Tests
2009-08-26  09:13    <DIR>          200930
2009-08-26  09:24    <DIR>          200940
...
C:> dir H:200940
...
Directory of H:Tests200940
...
C:> cd Windows
C:Windows> H:
H:Tests> dir C:System32
...
Directory of C:WINDOWSSystem32
...

(the ... is cut data that isn’t relevant)

As you can see the drive:directory syntax is highly relevant to the current working directory of each drive. In the case of explorer, it is reliant on the current working directory for your user and the root of every other drive.

So while my home directory is H: I can use the H:directory syntax to get to any folder under my home directory, but if I use C:directory I am limited to the root of that drive.

Correct syntax is C:foldersubfolder, note the backslash after C:
My guess is that there’s some amount of allowance for c:folder name but that it doesn’t work completely, leading to the inconsistencies you note.

The difference between path that is working and the one that is not is in the fact there are spaces in the name. If you were to put the complete name (without backslash after colon) in quotes and try to open it you will get the same error as with folders that don’t contain spaces.

For directly opening folder it works both ways, for opening a path that contains subfolder it doesn’t.

So for example this will work (if the folders exist of course):

  • c:folder with a long namesubfolder
  • c:folder-with-a-long-name-without-spaces

while this won’t:

  • c:folder-with-a-long-name-without-spacessubfolder
  • “c:folder with a long namesubfolder”

I searched for an explanation but so far failed to find one.

Leave a Reply

Your email address will not be published.