Forbidden file and folder names on Windows

Posted on Thursday 16 November 2006

Here’s an interesting experiment. On a Windows desktop, right-click on the desktop, and create a new Folder. Then, try renaming it ‘aux’. Can’t do it, right? There are certain restricted words that cannot be used to name folders or files, even though they use regular characters. You can’t even name it, say, ‘aux.test’. I came across this bug when editing files in CVS that were sourced on a Linux machine. I checked out the repository, but got errors for a folder named ‘aux’. I ended up doing work on a Linux machine to get around this, as there would be no way I would be able to work on the files there from Windows.

The following are reserved names, which cannot be assigned to a folder or file (normally):

  • CON
  • PRN
  • AUX
  • CLOCK$ (NT and older)
  • NUL
  • COM1
  • COM2
  • COM3
  • COM4
  • COM5
  • COM6
  • COM7
  • COM8
  • COM9
  • LPT1
  • LPT2
  • LPT3
  • LPT4
  • LPT5
  • LPT6
  • LPT7
  • LPT8
  • LPT9

It’s not impossible to create a file with that name, however. You just need to break out the old command line. From a Windows XP box, open up a command window (Start->Run, type cmd) and try:

md \\\\.\\c:\\aux

Congratulations, you’ve just created a folder named ‘aux’! You can even browse to it in Windows Explorer. To break down what the above does: the md stands for “make directory”. Specifying \\.\c:\aux means (in UNC format) on the local machine, volume C:, folder aux.

However, you still can’t delete it from Windows Explorer. To do that, you have to go back to the shell:

rd \\\\.\\c:\\aux

Aside from wowing your neighbors with your random geek knowledge, is there a practical use for this information? While I can’t think of any, it’s good to know to avoid using these, if doing cross-platform development. Do not use these names on a file on a Linux machine if they are going to be opened or edited by Windows users! This includes files and directories with those names but with an extension, such as aux.txt.

References:

3 Comments for 'Forbidden file and folder names on Windows'

  1.  
    Ritesh Aswal
    March 21, 2007 | 3:04 am
     

    just right click on rename and then press alt+255
    Give the name
    CON
    PRN
    AUX
    CLOCK$ (NT and older)
    NUL
    COM1
    COM2
    COM3
    COM4
    COM5
    COM6
    COM7
    COM8
    COM9
    LPT1
    LPT2
    LPT3
    LPT4
    LPT5
    LPT6
    LPT7
    LPT8
    LPT9

  2.  
    Ritesh Aswal
    March 21, 2007 | 3:05 am
     

    It will work

  3.  
    Alin Faur
    March 26, 2007 | 9:13 am
     

    Actually, the 255 ASCII code corresponds to a space, so the name won’t be “AUX”, but ” AUX”, which is different from the one wanted, so it is logic that it will allow you to do it.
    In fact, it’s the same as if you tiped “ZAUX” or “_AUX”, which means that it’s not included in the list mentioned above ;)

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI