C# Windwos文件路径太长问题

2019-03-13  本文已影响0人  UnityAsk

当File.Create 或者 File.Copy 路径太长,超出windows限制的时候,可以在前面添加 "\?"
比如 : "\?\D:\very long path".

he Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters). To specify an extended-length path, use the "\?" prefix. For example, "\?\D:\very long path".

https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file

上一篇 下一篇

猜你喜欢

热点阅读