Search code examples
windowswindows-7uncnetwork-drivenetwork-share

\\?\UNC\server\share\path\file.exe not working


I'm working in a project that stores files with very long paths.

I need to use network paths such as \\server\share\files.. paths. But I cannot figure out why its not working. I'm running Win7

\\server\share\path\file.exe ( This works but not for very long paths ~266 char long)

This wiki page https://en.wikipedia.org/wiki/Path_%28computing%29 specifies that syntax \\?\UNC\server\share\path\file.exe should work for longer paths but I can't get it to work for either long or short paths.. Not supported for Win7 ?

Anyone has a solution of how i can point to long network paths using a \\xxx syntax with length ~266 characters?


Solution

  • Thanks to Harry Johnston, as a summary to how I solved my problem:

    • Windows Explorer does not support then \\?\UNC\.. syntax.
    • Using \\?\UNC\server\folder\.. together with Python 3.4 and shutil.copy2() works perfectly fine. (Which I assume uses the mentioned Unicode API from comments above)

    when presenting the user with a directory path i remove ?\UNC\ and leave them with a simple \\server\path\.. path.. (which they, if they want to, copy paste into windows explorer and open the directory.