开发者

Complete List of forbidden file and folder names for windows

开发者 https://www.devze.com 2023-01-25 03:30 出处:网络
On Windows file names like com1开发者_如何学C.txt or lpt1.txt are forbidden. Is there a list of all forbidden file and folder names on windows (or forbidden chars in the file and folder names like :?

On Windows file names like com1开发者_如何学C.txt or lpt1.txt are forbidden. Is there a list of all forbidden file and folder names on windows (or forbidden chars in the file and folder names like :? ...)


The list of invalid characters is:

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

Plus characters 1 to 31

Source

But you should use System.IO.Path.GetInvalidFileNameChars and System.IO.Path.GetInvalidPathChars (or their equivalents) as recommended by FlipScript as a) it's neater and b) means that if the list ever changes you won't have to modify your application.


A list of reserved device names:

http://www.blindedbytech.com/2006/11/16/forbidden-file-and-folder-names-on-windows/


You didn't mention what platform you are using, but in .Net, you can use:

System.IO.Path.GetInvalidFileNameChars

and

System.IO.Path.GetInvalidPathChars

To return invalid file name and path characters.

0

精彩评论

暂无评论...
验证码 换一张
取 消