简体   繁体   English

Windows 7路径太长,无法使用.Net Framework 4.6.2创建260个字符以上的文件

[英]Windows 7 Path too long to create file above 260 Characters with .Net Framework 4.6.2

I trying to create file with more than 260 characters of file path with .Net Framework 4.6.2 我尝试使用.Net Framework 4.6.2创建文件路径超过260个字符的文件

This is working fine in Windows 10, but not able to create in Windows 7 environment. 在Windows 10中可以正常工作,但不能在Windows 7环境中创建。

I am trying to create file pragmatically using C#. 我正在尝试使用C#实用地创建文件。

Can you please help me to find solution that will work for any Windows environment. 您能帮我找到适用于任何Windows环境的解决方案吗?

Windows 7 does not support paths longer than 260 characters. Windows 7不支持超过260个字符的路径。 Stick to this limit if you can. 如果可以,请遵守此限制。 Unsupported functionality might break in a Windows update. Windows更新中可能会中断不支持的功能。

You can read more about this here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath This link also explains the '\\\\?\\' prefix which allows paths up to approximately 32'767 characters (Example: "\\\\?\\D:\\very long path"). 您可以在此处阅读有关此内容的更多信息: https : //msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath此链接还说明了'\\\\?\\ '前缀,最多可包含32'767个字符的路径(例如:“ \\\\?\\ D:\\非常长的路径”)。 But I haven't tested '\\\\?\\' with the C# API. 但是我还没有使用C#API测试'\\\\?\\'。

The following links might also be interesting 以下链接可能也很有趣

You can use ZetaLongPaths library for older systems and/or frameworks. 您可以将ZetaLongPaths库用于较旧的系统和/或框架。 There are several similar libraries exists, but this one is probably the best. 存在几种类似的库,但是这一库可能是最好的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM