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.
File Names You Can’t 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 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.
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.
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.
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
— foone (@Foone) November 3, 2018
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.
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.
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!
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.
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.
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.