Full list of forbidden file and folder names for windows

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:? ...)

+7
windows
source share
3 answers

List of invalid characters:

  • <(less)
  • > (more)
  • : (colon)
  • "(double quote)
  • /(slash)
  • \ (backslash)
  • | (vertical rod or pipe)
  • ? (question mark)
  • * (asterisk)

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.

+11
source share
+8
source share

You did not indicate which platform you are using, but in .Net you can use:

 System.IO.Path.GetInvalidFileNameChars 

and

 System.IO.Path.GetInvalidPathChars 

To return an invalid file name and path characters.

+2
source share

All Articles