Possible Duplicate:
Unable to rename a folder or a file as 'con'

In linux it works, but not it Windows, I tried a lot and It just returns to "New Folder", why?


It is a reserved keyword:

Do not use the following reserved device names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see Namespaces.

Naming Files, Paths, and Namespaces

Additional Information

Raymond Chen also writes about these reserved names in his blog post What's the deal with those reserved filenames like NUL and CON?.

Long story short, they existed back in DOS 1.0 and are still around for compatibility reasons (no joke):

But why do we carry these magic filenames forward even today?

Because everybody still relies on them. Just look at all the batch files that do things like redirect to >NUL or test if a directory exists by asking "if exist directoryname\nul", or all the documentation that says to create a file with "copy CON ...".

| improve this answer | |

Com1 is the handle for serial port 1 on a pc (communication 1)

You may be able to do this from the command line by wrapping in quotes ( ren folder "com1"), but I'm unable to test right now.

| improve this answer | |
  • No, adding quotes doesn't help. The name com1 is reserved on the filesystem level, not at the parser level. – Roland Illig Dec 6 '19 at 10:21

You can't name folders/files COM[1-9] (there is more) because these are reserved as they are system communication ports.

A full list of reserved file/folder names can be found here.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.