首页 > 解决方案 > 将 Windows 磁盘路径转换为注册表文件中的 Uri 路径

问题描述

正如我在问题中已经提到的,我正在尝试将 Windows 路径转换为注册表文件中的 Uri 路径。

然后将转换后的 Uri 路径复制到剪贴板,如下面的代码所示:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Copy As Uri Info]

[HKEY_CLASSES_ROOT\*\shell\Copy As Uri Info\command]
@="cmd.exe /q /v:on /e:on /c \"set FilePath=\"%1\" & set UriPath=file:///%%FilePath:\=/%% & echo !UriPath!|clip\""

[HKEY_CLASSES_ROOT\Directory\shell\Copy As Uri Info]

[HKEY_CLASSES_ROOT\Directory\shell\Copy As Uri Info\command]
@="cmd.exe /q /v:on /e:on /c \"set FilePath=\"%1\" & set UriPath=file:///%%FilePath:\=/%% & echo !UriPath!|clip\""

但是,当我运行此注册表文件,然后右键单击并在任何文件或文件夹上选择“复制为 Uri 信息”时,它会复制“!UriPath!” 到剪贴板。

任何人都可以帮忙吗?

标签: windowspathwindows-10registryuri

解决方案


推荐阅读