Windows 禁用文件和文件夹名称的完整列表 [英] Complete List of forbidden file and folder names for windows

查看:51
本文介绍了Windows 禁用文件和文件夹名称的完整列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 上禁止使用 com1.txt 或 lpt1.txt 等文件名.是否有 Windows 上所有禁用文件和文件夹名称的列表(或文件和文件夹名称中的禁用字符,如 :? ...)

On Windows file names like com1.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 :? ...)

推荐答案

无效字符列表为:

  • <(小于)
  • >(大于)
  • :(冒号)
  • "(双引号)
  • /(正斜杠)
  • \(反斜杠)
  • |(竖条或管道)
  • ?(问号)
  • *(星号)

加号 1 到 31

来源

但是您应该使用 FlipScript 推荐的 System.IO.Path.GetInvalidFileNameCharsSystem.IO.Path.GetInvalidPathChars(或它们的等效项)作为 a)它更整洁b) 意味着如果列表发生变化,您将不必修改您的应用程序.

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.

这篇关于Windows 禁用文件和文件夹名称的完整列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆