If you’ve been using a PC for as long as me then you’d recall how it was possible to use the command line to send the output of a command to another device. In order for that to work, DOS (the operating system that was the foundation for many versions of Windows) had a bunch of reserved words that couldn’t be used as file names. And for four decades, those reserved names have persisted and can be a pain in the butt for anyone trying to move files around that are named according to those reserved words that no-one uses any more.
The whole mess was recently reported by @foone who discovered the bug while copying files from an NTFS partition mounted to a Linux system over to Windows 10. He goes into exhaustive detail about how these reserved words became part of Windows 10 even though Windows 10 is a descendant of Windows NT and not Windows 95 (which was a child of MS-DOS). Microsoft decided to retain these reserved words in the name of backwards compatibility.
The offical list of reserved names that you cannot use for file names is CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. And it doesn’t matter whether you add a file extension to the names. So, CON.txt, CON.bmp or any other variant can’t be used. And these names are baked into the operating system source code. There’s no way around it.
Back in the day, these names were used as names for hardware devices. For example, if I wanted to send a file to my printer, I could enter something like
copy myfile.txt > LPT1
That would send the text file to the printer connected on my first parallel port (which was typically called LPT1).
@poone’s article goes into the history of how this came to be – it goes back to the days of CP/M and the earliest versions of DOS, from the days before graphical interfaces were commonplace.
Next time your IT department says they’ll take a week to fix a bug, remember that Microsoft has been hanging on to this nugget since before Luke met Han and rescued Leia and destroyed the first Death Star.