Why can't we make CON, PRN,Null folder in windows? [duplicate]

When i make new folder and rename it to nul it says The Specified device name is invalid.

then I searched which are the other folders we can't make, and get names con, nul, prn ?

what are these names stands for ? and why can't we make folders with these names ?


Solution 1:

It all begins with the old PIP CP/M command - this command, used to copy files, allowed you to specify special device names instead of files.

Gary Kildall, who developed CP/M, based much of the design of its file structure and command processor on operating systems from Digital Equipment, such as RSTS/E for the PDP-11. Besides accessing files on a floppy disk, the PIP command in CP/M could also transfer data to and from the following "special files":

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:

These were not true device files, however, because their handling was limited to PIP.

Then DOS comes around in the early 80's, an 8086 CP/M clone meant to work on the then-new IBM PC. DOS extended this concept a bit further - the above were "special files" and could be specified wherever a file was expected in DOS commands. So the built-in DOS copy command could be used to print a document by executing copy myfile.txt prn:. (Later versions of CP/M might have been able to do this but I doubt it.)

Flash forward to Windows 95. Itself being built on top of DOS, the code handling these special filenames remained, but evidently weren't integrated too well in the GUI portion of Windows 95. It caused some problems such as the CON\CON bug - and this was known to cause issues with IE as well.

Likely because of paranoia of further lurking bugs (even though none should exist in NT based versions of Windows) Microsoft decided to make it where Explorer always rejects any attempt to create a file of that name. It's funny that even in the Windows 8 system I'm using now, I still can't make a folder named "con." (Windows 10 still won't let you do this).