是否有充分的理由将 Windows 文件名扩展名限制为三个字符?
我正在创建一个实用程序,它将以特定的二进制格式将数据存储在平面文件上。 我希望文件扩展名特定于我的应用程序。除了旧的 8.3 文件名限制之外,是否还有其他原因将扩展名限制为 3 个字符,如果没有,限制是什么?我可以有 myfilename.MyExtensionSoHandsOffEverybodyElse 吗?
I am creating a utility that will store data on flat file in a specific binary format.
I want the filename extension to be specific to my application. Is there any reason other than the old 8.3 filename limit for restricting the extension to 3 characters, and if not, what is the limit? Can I have myfilename.MyExtensionSoHandsOffEverybodyElse ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是从旧的 Windows 3.x/MSDOS 时代遗留下来的。如今,有很多文件名的扩展名超过 3 个字符。
如果我没记错的话,Windows XP 的路径名(包括文件名)的最大字符数限制为 255 个字符。
This is a hold over from the old windows 3.x/MSDOS days. Today, there are plenty of file names that have more than 3 character extensions.
If I remember correctly, Windows XP had a maximum character limit for path names (including the file name) of 255 characters.
根据我的经验,在看到一些非 3 字符扩展名后,我会说这是一个传统问题,非常欢迎您使用
myfilename.MyExtensionSoHandsOffEverybodyElse
。In my experience, having seen a few non-3-character extensions I'd say that it's a matter of tradition, and you're perfectly welcome to use
myfilename.MyExtensionSoHandsOffEverybodyElse
.这样做的唯一充分理由是您计划支持 Windows 9x。如果您只针对 XP 及更高版本(就像现在的大多数项目一样),那么 8.3 就无关紧要了。
事实上,Windows 本身在 Vista 及更高版本中以长扩展名文件名存储内容,例如,用于保存搜索的 .search-ms。
The only good reason for doing this is if you plan to support Windows 9x. If you're only targeting XP and later, as with most projects nowdays, the 8.3 thing is irrelevant.
In fact, Windows itself stores things in long-extension filenames in Vista and later, for example, .search-ms for saved searches.
不,没有充分的理由将扩展名限制为 3 个字符。然而,如果用户必须记住它,那么较短的描述性名称会更好。例如,大多数人都知道 .html 或 .doc 文件将包含什么内容。
只要您做出合理的尝试以避免与主要软件的命名冲突,就不应该有问题。由此推论,除非您创建一些非常长的扩展,并且该扩展仅对您的软件是唯一的(即使这样,也不能保证),否则您选择的扩展将始终受到当其他人的软件像您在这里所做的那样选择其程序的数据文件扩展名时,会发生名称冲突。
No, there isn't a good reason to limit the extension to 3 characters. However, a shorter, descriptive name is better if a user has to remember it. For example, most people know what a .html or .doc file would contain.
As long as you make a reasonable attempt to avoid naming collisions with major software there shouldn't be an issue. A corollary to that is the fact that unless you create some insanely long extension that will only ever be unique to your software (and even then, it's not guaranteed), the extension you choose will always be subject to name collision by other people's software when they choose their program's data file extension as you are doing here.