Forbidden File Names on Windows 10

When I switched from Linux/OSX  to Windows 10, I encountered problems with “disappearing files.”

First time it happened:

I have a web application with a directory  named “aux.” When copying over the project from Linux to Windows this folder and its contents silently disappear.

Second time it happened:

Pulling the textmate.ruby bundle from GitHub:

$ git clone git@github.com:textmate/ruby.tmbundle.git
Cloning into 'ruby.tmbundle'...
remote: Counting objects: 4012, done.
remote: Total 4012 (delta 0), reused 0 (delta 0), pack-reused 4012
Receiving objects: 100% (4012/4012), 1001.74 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2061/2061), done.
Checking connectivity... done.
error: unable to create file Commands/@variable ||= memoized.tmCommand (Invalid argument)
error: unable to create file Commands/Enclose in * (RDoc comments).tmCommand (Invalid argument)
error: unable to create file Macros/class .. < DelegateClass .. initialize .. end (class).plist (Invalid argument)
error: unable to create file Macros/each_char { |chr| .. } (eac).plist (Invalid argument)
error: unable to create file Macros/each_cons(..) { |group| .. } (eac).plist (Invalid argument)
error: unable to create file Macros/each_slice(..) { |group| .. } (eas).plist (Invalid argument)
// ... snip ...

Argh…

List of reserved file names on Windows 10:

The following are (case insensitive) reserved names which cannot be assigned to a directory or file in Windows 10 :

  • CON
  • PRN
  • AUX
  • NUL
  • COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM0
  • LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, LPT0

List of invalid file characters on Windows 10:

The following are special characters which cannot be assigned to a directory or file in Windows 10 :

  • < (less than)
  • > (greater than)
  • : (colon)
  • (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)

Sources:

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx

12 thoughts on “Forbidden File Names on Windows 10”

  1. Hey Dac, my impression is that you can be moved by rational arguments. I’m curious, what rational argument moved you to consider a Windows 10 OS?

    1. C# is now open source. In 2014 I worked a job where I coded C# and, well, I liked it. I decided I could no longer simply put my fingers in my ears singing “Na na na na I can’t hear you!” to the world’s largest supplier of operating systems.

      Yes, I understand the distinction between Libre and Open and at this point in my life I am willing to make the trade off. I think Microsoft is setting up for the next decade and by me switching my laptop I am making a bet.

      IMHO OSX is moving in the opposite direction. For the last 3 years I’ve been running Ubuntu and it was a lot fun but I’m taking a break. I want to better understand the daily grind that is the Windows world through immersion.

      The freedom to make irrational decisions.

      1. Thanks for the explanation. I knew there was a reason.

        I am feeling like I am at the tail end of interfacing with OSX but will likely move my desktop environment towards Linux. Questions around privacy with Windows 10 have kept me away from giving it too much consideration. That and, I’ve worked in ‘Windows only’ places, so the thrill is gone.

        http://arstechnica.com/information-technology/2015/08/windows-10-doesnt-offer-much-privacy-by-default-heres-how-to-fix-it/

      2. I agree 100% with Windows 10 moving in a positive direction and macOS is moving in a negative direction. Apple is pushing harder and harder to lock people into their OS, and in doing so are making their OS less flexible. Microsoft on the otherhand has been moving towards being more open, flexible, and robust.

  2. I happened to find this blog by accident, and I want to point out, this is not a Windows 10 thing. This list of reserved names and invalid characters has stayed the same at least since Windows 95, as it mostly comes from DOS.

  3. create a folder at any location(let’s say Desktop) on windows 10 and try to assign com0 or lpt0. It throws an error.

    1. I stand corrected. You are right.

      If I try in File Explorer instead of at the command prompt I get an error.

      Added COM0 and LPT0 to list.

  4. Try to name an innocent image file from “something.png” to “aux.png”. It cannot be read anymore. At least it can still be renamed. (I’m using a third-party file manager, not Explorer.) So the names are also invalid if followed by an extension.

    But I am able to create a directory named “com0” or “COM0” and create files in it with NotePad++. The file size changes are not shown automatically, probably because the filesystem watcher doesn’t work on that name, but it can be used as a directory name. “COM1” is also a working directory name. Sometimes it tends to disappear unexpectedly, but it comes back and the files in it are also still there. Strange things anyway. Microsoft should finally get rid of that DOS “feature”.

  5. Not only are those raw filenames illegal, even adding a extension won’t help. For example, AUX.c and AUX.h are invalid. (Tested on Windows 7 by renaming files in Explorer.) That bit me when trying to look at some Linux source on a Windows box recently.
    Pretty annoying.

  6. You are right. All COM0-COM9 is invalid except for COM10. There could be a way to rename into an invalid name, such as the terminal. Why does Windows cancel them, such as CON.

    The reason is /con/con.

Leave a Reply to Dac Chartrand Cancel reply

Your email address will not be published. Required fields are marked *