CustomURLProtocol in browser: 如何使用UNC路径调用Windows资源管理器

huangapple go评论60阅读模式
英文:

CustomURLProtocol in browser: how to call windows explorer with unc path

问题

I registered a CustomURLProtocol fileexplorer in my registry. Its calling cmd /c set url=\"%1\" & call set url=%%url:fileexplorer:=%% & call start explorer file:%%url%%.

Calling local folders works well. c:\mydata opens in the fileexplorer with the URL fileexplorer:c:%5Cmydata.
But how do I open an UNC-address like \\myserver\mypath?
Running call explorer file:\\myserver\mypath from the cmd prompt works fine. A URL fileexplorer:%5C%5Cmyserver%5Cmypath fails (opening the explorer as if no path were given).

英文:

I registered a CustomURLProtocol fileexplorer in my registry. Its calling cmd /c set url=\"%1\" & call set url=%%url:fileexplorer:=%% & call start explorer file:%%url%%.

Calling local folders works well. c:\mydata opens in the fileexplorer with the URL fileexplorer:c:%5Cmydata.
But how do I open an UNC-address like \\myserver\mypath?
Running call explorer file:\\myserver\mypath from the cmd prompt works fine. A URL fileexplorer:%5C%5Cmyserver%5Cmypath fails (opening the explorer as if no path were given).

答案1

得分: 0

这是翻译好的部分:

在经过许多尝试和错误之后,我找到了这个命令:
cmd /c set url="%1" & call set url=%%url:fileexplorerunc:=file:%% & call start explorer %%url%%
URL 应该是 fileexplorerunc://myserver/mypath,它也适用于本地路径 fileexplorerunc://c:/mypath。当然,这仅适用于 Windows 操作系统。

英文:

After a lot of trial & error I found this command:
cmd /c set url="%1" & call set url=%%url:fileexplorerunc:=file:%% & call start explorer %%url%%
The URL should be fileexplorerunc://myserver/mypath and it also works with local paths with fileexplorerunc://c:/mypath. This, of course, only works with windows OS.

huangapple
  • 本文由 发表于 2023年5月10日 17:17:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76216755.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定