Why you can't name a file CON in Windows

This is a screenshot from Windows 10. Why does it tell that a 10kb file is “too large?” This is a bug/misfeature dating way back to 1974.

I’m a Linux user, And in Linux, we have a nice feature of having everything as files - printers, keyboards, mice, disks, socket, pipes, consoles - everything is a file. This helps in using the same syntax for read/write to and from files as well as everything else.

This feature comes from UNIX, created in 1969. It was done by having special files in special directories. For example, here’s a screenshot of my system -

/dev/tty* ‘s are the consoles

mouse0 is my mouse, and I can “read” from it the same way I’d read a file (say, using cat)

When I ‘cat’ and move my mouse, I get this “data” read from my mouse.

We also have /dev/zero to get infinite zeroes, /dev/random to get random bytes etc.

This idea of “everything is a file” was bought to CP/M  in 1974 by Gary Kildal, and this is where it all began. You see, CP/M was designed for 8 bit computers with very little memory, and no hard drives. So, instead of special directories you had different disks.

But if don’t use directories, where do you keep your special files? (/dev/ in UNIX for example) The answer they came up with was - “everywhere”. They existed in every directory. They were omnipresent so that they could be used from any directories. So, for example, you could access the “file” LST from anywhere (LST is the printer.)

[Note: they weren’t implemented in OS layer. Basically they were “included” in the PIP  command used to copy files, and not every command could use them. Here’s a full list -

CON: — console (input and output)
AUX: — an auxiliary device. In CP/M 1 and 2, PIP used PUN: (paper tape punch) and RDR: (paper tape reader) instead of AUX:
LST: — list output device, usually the printer
PRN: — as LST:, but lines were numbered, tabs expanded and form feeds added every 60 lines
NUL: — null device, akin to /dev/null
EOF: — input device that produced end-of-file characters, ASCII 0x1A
INP: — custom input device, by default the same as EOF:
OUT: — custom output device, by default the same as NUL:

But what should their extension be? Programs love right extensions (unlike UNIX, which can use magic to determine file type no matter the extension). For example, if you’re saving a file, you can name it LST to print it directly. But what happens if the program tries to save it as LST.TXT?

The answer was, it would still work. On top of existing everywhere, these files were present in every extension. So, LST, LST.TXT, LST.ABC all referred to the printer.

Now, CP/M went big, and got accepted into businesses. In early 80’s, IBM wanted to use CP/M for their “PC”  project, but CP/M for x86 wasn’t released yet (it released 6 months after IBM PC was released)

Enter Microsoft.

IBM PC used PC-DOS  , developed by Microsoft. This was the ancestor of MS-DOS, now where did PC-DOS come from? It came from QDOS  (Quick and Dirty Operating System) by Tim Paterson, which Microsoft bought.

QDOS was written because CP/M for X86 wasn’t available, and QDOS was inspired by CP/M. And it took the idea of special files. So, QDOS had AUX, LST, PRN too.

But PC-DOS took this idea further - instead of having them limited to the copy command, they were usable wherever a file was expected. Ever wonder why when you learned command prompt, you used to created a file using “COPY CON” command? Well, it tells DOS to “COPY” from “CON” which is the console. But now you could do DIR > PRN to print your directory listing!

In 1983, PC-DOS 2.0 was released for IBM XT  which had a hard drive. So, MS stepped up the DOS game and added directory support among many other improvements.

Ok, now that we have directories, can we move these special files to a separate directory?

Nah, it’s MS, and MS drools over backward compatibility. People had already gotten used to PC-DOS 1.0. Suddenly moving these files would now break the existing stuff.

So, they remained.

And came Windows 95. It was built on top of DOS, so they remained in 95.

Then came the Windows NT branch, (which was supposed to be “New Technology”) but they wanted compatibility with DOS, so XP merged these two lines, and these special files creeped in to 2019, 45 years later!

Here’s the official listing  by Microsoft:


SO, there you go - a random bug you are not likely to encounter that is almost as old as most of the people reading this, that still lingers these days thanks to backwards compatibility. (This is not the first (or last) time Microsoft has chosen backward compatibility over logic though)

Source: This thread on Twitter

Aniket Bhattacharyea

Aniket Bhattacharyea