On Windows, file names such as com1.txt or lpt1.txt are not allowed. There is a list of all forbidden file and folder names on windows (or forbidden characters in file and folder names, such as:? ...)
List of invalid characters:
Pluses of characters from 1 to 31
A source
But you should use System.IO.Path.GetInvalidFileNameChars and System.IO.Path.GetInvalidPathChars (or their equivalents), as recommended by FlipScript, since a) it is ahead and b) means that if the list ever changes, you donβt will have to modify your application.
System.IO.Path.GetInvalidFileNameChars
System.IO.Path.GetInvalidPathChars
List of reserved device names:
http://www.blindedbytech.com/2006/11/16/forbidden-file-and-folder-names-on-windows/
You did not indicate which platform you are using, but in .Net you can use:
and
To return an invalid file name and path characters.