Windows 10仍然不允许您使用1974年保留的这些文件名 您所在的位置:网站首页 windows不合法文件名 Windows 10仍然不允许您使用1974年保留的这些文件名

Windows 10仍然不允许您使用1974年保留的这些文件名

2024-07-07 05:56| 来源: 网络整理| 查看: 265

Windows “reserves” certain file names and doesn’t let you use them anywhere. Forget calling a file “con.txt” or “aux.mp3”. This is all because of a choice made in 1974 and Microsoft’s thirst for eternal backwards compatibility.

Windows“保留”某些文件名,并且不允许您在任何地方使用它们。 忘记调用文件“ con.txt”或“ aux.mp3”。 这完全是由于1974年做出的选择以及Microsoft对永恒的向后兼容性的渴望。

您无法使用的文件名 (File Names You Can’t Use)

Microsoft provides an official list of reserved file names, and here they are:

Microsoft提供了保留文件名的正式列表,它们是:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9

CON,PRN,AUX,NUL,COM1,COM2,COM3,COM4,COM5,COM6,COM7,COM8,COM9,LPT1,LPT2,LPT3,LPT4,LPT5,LPT6,LPT7,LPT8和LPT9

Note that you can’t use these file names with any file extension. So you can’t name a file “con.txt”, “con.jpg”, “or “con.doc”. And Windows isn’t case sensitive, so it doesn’t matter whether it’s CON, con, or CoN—Windows won’t let you use that name.

请注意,您不能将这些文件名与任何文件扩展名一起使用。 因此,您无法将文件命名为“ con.txt”,“ con.jpg”或“ con.doc”。 而且Windows不区分大小写,因此无论是CON,con还是CoN都不重要-Windows不允许您使用该名称。

You can try it yourself. Try saving a file as “con.txt” or “lpt6.txt” in Notepad. Or try renaming any file to one of these names in File Explorer. Windows just won’t let you do it.

您可以自己尝试。 尝试在记事本中将文件另存为“ con.txt”或“ lpt6.txt”。 或者尝试在“文件资源管理器”中将任何文件重命名为这些名称之一。 Windows只是不允许您这样做。

Of course, Windows also restricts file names in other ways. You can’t use various special characters like the following in names, either. Consult Microsoft’s official documentation for more information.

当然,Windows还以其他方式限制文件名。 您也不能在名称中使用如下所示的各种特殊字符。 有关更多信息,请查阅Microsoft的官方文档 。

1974年发生了什么,我们为什么要关心? (What Happened in 1974, and Why Should We Care?)

It is 2018 and this error message is a mistake from 1974.This limitation, which is still found in the very latest Windows 10, dates back to BEFORE STAR WARS. This bug is as old as Watergate. pic.twitter.com/pPbkZiE57t

现在是2018年,此错误消息是1974年的一个错误。此限制仍然可以在最新的Windows 10中找到,其历史可以追溯到星战之前。 此错误与Watergate一样古老。 pic.twitter.com/pPbkZiE57t

— foone (@Foone) November 3, 2018

— foone(@Foone) 2018年11月3日

As @Foone recently explained on Twitter, this issue dates back to 1974. In UNIX, “everything is a file.” (The same is true in UNIX-like operating systems like Linux today.) Hardware devices were represented at special paths like /dev/lp0 for the first printer and /dev/tty for the console.

正如@Foone最近在Twitter上解释的那样,此问题可以追溯到1974年。在UNIX中 ,“ 一切都是文件” 。 (在今天的Linux之类的类似UNIX的操作系统中也是如此。)硬件设备在特殊路径中表示,例如第一台打印机的/ dev / lp0和控制台的/ dev / tty。

In 1974, this same concept was added to the CP/M operating system. Unfortunately, CP/M was designed for computers with very little memory and no hard drives. It used multiple disks and no directories, so those special files representing devices effectively appeared everywhere, on every disk.

1974年,将相同的概念添加到CP / M操作系统中。 不幸的是,CP / M是为内存很少且没有硬盘驱动器的计算机设计的。 它使用多个磁盘,没有目录,因此代表设备的那些特殊文件有效地出现在每个磁盘上的任何地方。

So, when you were saving a text file, you could tell your text editor to “save” it to the printer device, which would print it. But text editors and other programs like adding file extensions like “.txt”, so CP/M just ignored the file extension for these device files. In other words, if a text editor tries saving a file to the name of the printer device followed by “.txt”, CP/M just assumed it was referring to the printer device and ignored the file extension. Now the feature worked properly in every application—great!

因此,在保存文本文件时,您可以告诉文本编辑器将其“保存”到打印机设备,然后再进行打印。 但是文本编辑器和其他程序喜欢添加文件扩展名,例如“ .txt”,因此CP / M只是忽略了这些设备文件的文件扩展名。 换句话说,如果文本编辑器尝试将文件保存为打印机设备的名称,后跟“ .txt”,则CP / M只是假定它是在指打印机设备,而忽略了文件扩展名。 现在,该功能可以在每个应用程序中正常工作,很棒!

Sure, it’s a dirty hack, but who cares? Well, CP/M caught on. Eventually PC-DOS came along, and it kept that useful CP/M feature. PC-DOS 2.0 added directories back in 1983, but Microsoft chose to have these device files appear in all directories for compatibility with existing DOS software rather than place them in a special device folder.

当然,这是肮脏的骇客,但谁在乎呢? 好吧,CP / M很流行。 最终PC-DOS出现了,它保留了该有用的CP / M功能。 PC-DOS 2.0在1983年添加了目录,但是Microsoft选择让这些设备文件出现在所有目录中以与现有DOS软件兼容,而不是将它们放置在特殊的设备文件夹中。

Eventually, Windows 95 came along, and it was built on top of DOS. Windows NT wasn’t based on top of DOS, but it did want to be backwards compatible with Windows 95 applications. Windows 10 is still based on Windows NT, and it works the same way. The same applies on Windows 7, of course.

最终,Windows 95出现了,它是基于DOS构建的。 Windows NT并非基于DOS,但它确实希望与Windows 95应用程序向后兼容。 Windows 10仍基于Windows NT,并且工作方式相同。 当然,在Windows 7上也是如此。

Now, it’s over forty years later and we still can’t name files “con.txt” or “aux.mp3” because Windows wants to stay compatible with ancient programs that might be using this feature. It’s a good example of how intensely Microsoft is committed to backwards compatibility.

现在,已经有40年了,我们仍然不能命名文件“ con.txt”或“ aux.mp3”,因为Windows希望与可能正在使用此功能的古老程序保持兼容。 这是Microsoft致力于向后兼容的一个很好的例子。

翻译自: https://www.howtogeek.com/fyi/windows-10-still-wont-let-you-use-these-file-names-reserved-in-1974/



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有