Windows “reserves” certain file names and will not let you use them anywhere. Forget about calling a file “con.txt” or “aux.mp3”. This is all due to a choice made in 1974 and Microsoft’s hunger for eternal backward compatibility.
File names you cannot use
Microsoft provides an official list of reserved file names, and here they are:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8 and LPT9
Note that you cannot use these file names with any file extension. So you can’t name a file “con.txt”, “con.jpg”, “or” con.doc. “And Windows is not case sensitive, so it doesn’t matter if it’s CON, con or CoN – Windows lets you don’t use that name.
You can try it yourself. Try saving a file as “con.txt” or “lpt6.txt” in Notepad. Or try renaming a file to one of these names in File Explorer. Windows just won’t let you do it.
Windows, of course, limits file names in other ways too. Also, you cannot use various special characters like the following in names. Consult Microsoft’s official documentation for more information.
What happened in 1974, and why should we be concerned?
It’s 2018 and this error is a 1974 mistake.
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
– foone (@Foone) November 3, 2018
As @Foone recently explained on Twitter, this problem dates back to 1974. In UNIX, “everything is a file.” (The same is true for UNIX-like operating systems such as Linux today.) Hardware devices were listed on special paths such as / dev / lp0 for the first printer and / dev / tty for the console.
In 1974 the same concept was added to the CP / M operating system. Unfortunately, CP / M is designed for computers with very little memory and no hard drives. It used multiple drives and not folders, so those special files representing devices effectively appeared everywhere, on every drive.
So if you saved 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 to add file extensions such as “.txt”, so CP / M simply ignored the file extension for these device files. In other words, if a text editor tried to save a file under the printer device name followed by “.txt”, CP / M assumed it referred to the printer device and ignored the file extension. Now the feature was working properly in every application – great!
Sure, it’s a dirty hack, but who cares? Well, CP / M caught on. Eventually, PC-DOS came along, and it kept that nifty CP / M feature. PC-DOS 2.0 added folders in 1983, but Microsoft chose to have these device files appear in all folders for compatibility with existing DOS software instead of putting them in a dedicated device folder.
Eventually Windows 95 came and was built on top of DOS. Windows NT was not based on DOS, but it wanted to be backward compatible with Windows 95 applications. Windows 10 is still based on Windows NT and works the same way. The same, of course, applies to Windows 7.
Now it is more than 40 years later and we still cannot name the files “con.txt” or “aux.mp3” because Windows wants to remain compatible with old programs that may have used this feature. It’s a great example of how deeply Microsoft is committed to backward compatibility.
Updating: We were told that CP / M originally required a colon – in other words, instead of “CON” you had to type “CON:”. Apparently, the problem didn’t really start until 1981 with the release of MS-DOS and PC-DOS, removing the colon requirement. In DOS you could use “CON” instead of “CON:”. So maybe DOS is more to blame for this than CP / M.