If a program and a folder have the same name, the shell prefers the program

Raymond Chen

If you have both a folder named, say, C:\Folder and a program named C:\Folder.exe and you type C:\Folder into the Start.Run dialog, you get the program and not the folder.

Why is that?

Because it is common to have

 D:\Setup.exe D:\Setup\... 

where there is a setup program in the root, as well as a setup folder containing files needed by the setup program.

Before Windows 95, you couldn’t open a folder by typing its name. (If you wanted to view it in File Manager, you had to run File Manager explicitly.) As a result, programs written for earlier versions of Windows would have instructions like

  • Insert the floppy disk labelled “Setup”. (CDs were for the rich kids.)
  • From Program Manager, click File, then Run.
  • In the dialog box, type “A:\SETUP” and press Enter.

Since there was no such thing as “opening a folder”, the only option was to run the program A:\SETUP.EXE.

Windows 95 was required to prefer the program over the folder in order that those instructions would remain valid (substituting the Start button for the File menu).

And each version of Windows that prefers the program over the folder creates an environment wherein people who write setup programs rely on that preference, thereby securing this behavior for the next version of Windows.

But what if you really want to open the folder?

Append a backslash to force the path to be interpreted as a folder (A:\SETUP\).


Discussion is closed.

Feedback usabilla icon