请注意:本页内容发布于 1728 天前,内容可能已经过时,请注意甄别。
原文链接:https://devblogs.microsoft.com/oldnewthing/20041118-00/?p=37263
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.
如果有一个文件夹,比如是 C:\Folder,与此同时有一个程序,其路径为 C:\Folder.exe,当你在开始—运行中输入 C:\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.
因为同时在根目录下包含作为安装程序的 D:\Setup.exe 和作为存储安装程序所需文件的 D:\Setup\ 这个目录是很常见的情况。
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
在 Windows 95 之前,你是不能通过输入目录的名字(译注:即输入到目录为止的路径)来打开一个目录的。(如果你想在“文件管理器”中查看目录的内容,你必须刻意去运行“文件管理器”)因此,为早期版本Windows撰写的程序通常都包含有类似如下的操作指南:
- Insert the floppy disk labelled “Setup”. (CDs were for the rich kids.)
插入标有『Setup』(安装)标签的软盘。(那年头CD是有钱人才用得起的东西) - From Program Manager, click File, then Run.
在“程序管理器”中,单击“文件”,然后选择“运行” - In the dialog box, type “A:\SETUP” and press Enter.
在弹出的对话框中,输入“A:\SETUP”,然后按下回车键
Since there was no such thing as “opening a folder”, the only option was to run the program A:\SETUP.EXE.
由于并没有(通过运行对话框来)“打开目录”这种操作,(向上面这样做)唯一的结果就是运行了程序 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).
Windows 95 为了能让上面这样的操作指示仍然有效,(在遇到目录和程序同名的情况时)会优先选择运行程序而不是打开目录本身(当然还要将『文件菜单』替换为『开始菜单』)。
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.
另外,每个版本的 Windows 这种优先运行程序而不是打开文件夹的环境,又进一步促使用户在设计安装程序时依赖这种设计,进一步保证了这种设计可以被延续到下一个版本的 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\).
在最后加一个反斜杠(\),使其强制被解释为文件夹(A:\SETUP\)就可以了。
远嚣 Comment