NTFS中文件路径是否有长度限制? [英] Is there any length-limits of file path in NTFS?

查看:717
本文介绍了NTFS中文件路径是否有长度限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我不能在NTFS文件系统中创建一个深路径,该深路径的路径中的字符大于255? 似乎是FAT32的限制,但是在NTFS中也存在吗?谁能提供一些文件?

Why can not I create a deep path whose characters in path is more than 255 in NTFS File System? It seems a limits of FAT32, but also exist in NTFS? Can anyone provide some documents?

非常感谢!

推荐答案

260个字符的限制不是文件系统的限制,而是Win32 API的限制. Win32将MAX_PATH定义为260,这是API用来检查传递到诸如FileCreate,FileOpen等(在BCL中的.NET使用的函数)之类的函数中的路径的长度.

The 260 character limitation is not a limitation of the file system, but of the Win32 API. Win32 defines MAX_PATH as 260 which is what the API is using to check the length of the path passed into functions like FileCreate, FileOpen, etc. (which are used by .NET in the BCL).

但是,您可以绕过Win32规则并创建最多32K个字符的路径.基本上,您需要使用"\\?\ C:\ MyReallyLongPath \ File.txt"语法,没见过.最后我检查了一下.NET中的File和FileInfo类阻止了您使用这种类型的路径,但是您绝对可以从C/C ++中做到这一点.这是更多信息的链接.

However, you can bypass the Win32 rules and create paths up to 32K characters. Basically you need to use the "\\?\C:\MyReallyLongPath\File.txt" syntax which you may not have seen before. Last I checked, the File and FileInfo classes in .NET prevented you from using this type of path, but you can definitely do it from C/C++. Here's a link for more info.

http://msdn.microsoft.com/en -us/library/aa365247(VS.85).aspx

这篇关于NTFS中文件路径是否有长度限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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