C#:有什么办法可以绕过完全限定路径的 260 个字符限制吗?
我正在尝试找出一种方法来绕过这个可怕的 260 个字符的完全限定路径限制,同时我想知道为什么会有路径限制!?我知道对某些人来说 260 似乎“很多”,但自从我遇到这个问题以来,事实并非如此。
基本上:
为什么必须有字符数限制?
如何解决这个问题?
Possible Duplicate:
Why does the 260 character path length limit exist in Windows?
I'm trying to figure out a way to get around this dreaded 260 character fully qualified path limit and at the same time I wonder why the hell is there a path limit to begin with!? I know to some people 260 seems to be "a lot", but it truly isn't since I ran into this issue.
Basically:
Why must there be a character limit?
How does one get around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用
\\?\
UNC 前缀可以突破路径的“DOS 模式”。 UNC 路径的最大长度为 32k 个字符。更多信息请参见:http://msdn.microsoft.com/en-us/library /aa365247.aspx
Use the
\\?\
UNC prefix to break out of "DOS mode" for paths. The max length for UNC paths is 32k characters.More info here: http://msdn.microsoft.com/en-us/library/aa365247.aspx
来自 MSDN:
From the MSDN:
首先,这与 C# 无关,而与 Windows API 有关,其中存在该限制。 :)
看看这个问题及其答案,这将引导您访问 MSDN: 命名文件、路径和命名空间
Unicode 文件路径(在问题的答案和 MSDN 文章中进行了描述)可能是一种解决方案,但有一些注意事项。
Well, first, this has nothing to do with C# in particular, and everything to do with the Windows API, wherein that limit resides. :)
Take a look at this question and its answers, which will lead you to MSDN: Naming Files, Paths, and Namespaces
Unicode file paths (described in the answers to the question, and the MSDN article) may be as solution, with some caveats.