[thelist] OT - folder named con cannot be created on Windows OS

Scott Glasgow paladin at fuse.net
Thu Oct 13 14:37:56 CDT 2005

Andrew Clover wrote:
> VOLKAN ÖZÇELİK <volkan ozcelik at gmail.com> wrote:
>> An Indian discovered that nobody can create a FOLDER anywhere named
>> as "con". This is something pretty cool...and unbelievable... At
>> Microsoft the whole Team, including Bill Gates, couldn't answer why this 
>> happened!
> Dunno about that - it's actually quite a well-known glitch in the
> security world, as the situation used to be quite a lot worse: even
> just trying to access a filesystem object called 'con' could cause
> Windows to hang up, which caused no end of fun.

Actually, this makes perfect sense if you consider the nature of the CON 
device. As already pointed out by several members, DOS had a number of 
reserved names for devices. Some represented actual physical devices, such 
as PRN for the printer and CON for the console (represented by the keyboard 
or screen, depending upon I/O mode), and others logical devices, such as 
NUL. In the case above, "trying to access a filesystem object called 'con'," 
you're basically trying to _open_ the console device. When used as an input, 
the CON device is the keyboard; as an output, it is the screen. For example, 
the command

copy setup.log con

will cause the contents of setup.log to be displayed on the screen. CON in 
this case is the output device. Conversely,

copy con testfile.txt
This is a testfile. (hit Ctrl-Z to mark end of file, then enter)
        1 file(s) copied.

results in a text file named "testfile.txt," containing, "This is a 
tesfile." In this case, CON is the input device, represented by the keyboard 
(note the order of the commands; in the first, setup.log is the source of 
the copy, con the destination; in the second, con is the source and 
testfile.txt is the destination). In either case, neither can be "opened" by 
the file system in the same sense that a file can be opened, so if you tried 
to do so I would be surprised if Windows didn't hang.

> Of course it beggars belief they *still* haven't fixed it in the
> latest OS, but there's backwards compatibility for you I guess.

As far as "fixing" it, why? It's not broken. It is perhaps no longer as 
necessary as during the command line interface days of DOS, but I can tell 
you that it can be quite handy when you can't get to a GUI and need to 
display or create a file at the command line. And, jeez, with hundreds of 
characters available now for file names, is it really that big a deal that a 
few three-letter reserved device names are not available?

(DOS jockey since version 3.1) 

More information about the thelist mailing list