Why can't I create a folder named COM1 [duplicate]
Solution 1:
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 ...".
Solution 2:
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.
Solution 3:
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.