为什么在 Windows 中,不能将文件夹命名为“con”?
每当我尝试将文件夹命名为“con”(不带引号)时,它默认为其原始名称。
为什么这样做?
回到 MS-DOS 时代,“con”有特殊的含义。它引用了控制台,并允许您像对待任何其他文件一样对待它。例如,您可以通过键入来创建一个新的文本文件copy con new.txt
。然后你可以输入你的文字并^Z
在完成后点击。
问题是,你仍然可以这样做。因此,就文件系统而言,已经有一个名为con
. 还有其他保留名称,但是我看到在键入此名称时,其他答案中已经提供了这些名称。
Actually you can rename the folder to con
use this in the command prompt and this creates a system folder named con
on your C: Drive
md \\\\\.\\\C:\con
to remove this folder you need to use this in the command prompt
rd/s \\\\.\\\C:\con
And just for those that are wondering "so why would you?" - my name is CON and if I wish to use that as my folder I WILL so "bugger you MS"
Con "OzDing"
这可以追溯到 MS-DOS。从控制台读取或写入名为“CON:”的文件。我想 Windows 仍然支持它以实现向后兼容性。
来自微软技术网:
几个特殊的文件名是系统保留的,不能用于文件或文件夹:
CON、辅助、COM1、COM2、COM3、COM4、LPT1、LPT2、LPT3、PRN、NUL