Thursday, January 25, 2007

Creating a folder named Prn

Do you know that you cannot create a folder named Prn in Microsoft Windows operating systems?

It is true that you cannot create folder as such visually (Using Windows Explorer). Instead you can create the folder by using command prompt.

Just open the command prompt and type

mkdir file://.c:/prn to create a folder named con in the C drive.

If you need to remove the created folder, type
rd file:////C:/prn
So if you only needed to create a folder named prn this is it, but if you would like to know further read on.

This restriction is because printer is referred by prn in device level (Printer is considered as a virtual folder.). So if you are permitted to create a folder named prn Windows will get confused when it is told to print a document since there are two folders/devices.
What we do here is we are making the directory a network associated folder by using '\\.\'.

Prn is not the only word which is blocked by Windows. Following words are also blocked because they are also representing some device in device level as I have mentioned below.

Word - Represented Device
prn - Printer
con - Console
lpt1 to lpt9 - Parallel Port Interfaces on IBM PCs (Named because at that time this port is heavily used by Line Printers)
com1 to com9 - Communication Ports
aux - Serial Ports
nul - Null (Not 100% sure)

If you need to create folders with the above names you have to create them as network associated folders.

No comments: