Saturday, March 08, 2008

Creating folder named “con” on windows OS

Windows OS does not allow creating folder named like con, lpt1, lpt2, com1, etc. If you try creating it using Windows Explorer, it will simply ignore the name. If you try creating it through command prompt, it will say “The directory name is invalid.”

The reason could be it is not allowing creation of folder named with con… :

Back in old days when Windows was not there, “con” used to be a reserved word. Remember command “copy con”? We used it use that con word in those days. If you see words like lpt1, com1.. those are still in use. Com1 is used to access com1 device.


If you still want to create folder with name con, lpt1, etc. you can try following.


Prefix “\\.\” with full physical path where you would like to create the dir and create folder using command prompt.


Example:

D:\test>mkdir \\.\D:\test\con

3 comments:

  1. You can rename it using "ren" and then delete.

    C:\Documents and Settings\v-ashisb>ren \\.\D:\test\con toBeDeleted

    ReplyDelete
  2. Wow that was fun and amzing, i know that you can't create a folder with the ame con, but i didn't know about lpt1 and com1.

    Thats great

    ReplyDelete