Why cannot we create a folder named CON?


Hello friends I'm back again with some information about device files.
In windows, we cannot create folders with the following names:

PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, etc.

Now let’s see why can't we create such folder in windows.
These are known as Device files. They are reserved keywords used by MS-DOS based systems to allow access to certain ports and devices. MS-DOS uses device files for access to printers and ports. In simple, when you try to create folders with these names, it can cause confusion as they are used by the system. So folders cannot have these names.

1. I created a folder and tried to rename it to 'con'



2. And it showed this error



3. Then it renamed back to 'New Folder' automatically.



Let’s see the functions of these Device files.


Device keyword


As input

As output

CON
Receives typed data until ^Z (Ctrl-Z) (Undo) is pressed.
Prints data to the console.
PRN
N/A
Prints text to the printer.
AUX
Reads data from an auxiliary device, usually a serial port.
Sends data to an auxiliary device, usually a serial port.
NUL
Returns null or no data.
Discards received data.
CLOCK$
Returns system real-time clock.
N/A
LPT1 (also 2–9)
Reads data from the selected parallel port
Sends data to the selected parallel port
COM1 (also 2–9)
Reads data from the selected serial port
Sends data to the selected serial port

I collected all the above information from the internet, mixed and merged them together for you guys… 


When I was actually preparing this post, I became curious to find out what happens if I use these device files in command prompt… This is what I got. See for yourselves in upcoming images…



Can you note it???  When I gave the name in command prompt, it showed ' ' instead of 'con'..

Unlike others, 'NUL' was a different case,


I hope this was informative.. :)




Comments

Popular posts from this blog

The ALT codes

How a webcam works?