cygpath and unc paths

Federico Kircheis federico@kircheis.it
Mon Dec 16 13:24:54 GMT 2024


> This way, you're testing command interpreter, not WinApi.
> 
> The command interpreter has its own ideas about what you can and can not use
> with it.

Yes, after I saw it works with "-literal" I convinced my self it is a 
bug in PowerShell (I guess they strip the trailing \, but who knows).

But then I noticed that:

  * cd \\?\C:\Windows\; cd .. also fails (another bug in PowerShell?)
  * the "-d" parameter of Windows Terminal has a very similar issue
  * FindFirstFile (thus WinApi) documents that it does not work with the 
root directory ("Prepending the string "\\?\" does not allow access to 
the root directory", from 
https://docs.microsoft.com/windows/win32/api/fileapi/nf-fileapi-findfirstfilew)

So even if \\?\C:\ is a valid path (and to me it still looks like a 
valid one), support seems to be scarce or at least inconsistent with the 
tools provided by Microsoft.

>> and repeat the same operation with dir instead of ls.
> 
>> The error message is that the "value of argument path is not valid"
> 
> F.e. Far manager works just fine with `goto:\\?\C:\`. More or less.

Yes, Far was the only tool (except cygwin) that worked with every path 
I've tested; in this particular case, far \\?\C:\ opens the correct 
directory.


More information about the Cygwin mailing list