将Windows磁盘路径转换为注册表文件中的Uri路径

将Windows磁盘路径转换为注册表文件中的Uri路径,windows,path,windows-10,registry,uri,Windows,Path,Windows 10,Registry,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 FilePa

正如我在问题中已经提到的,我正在尝试将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!”复制到剪贴板中

有人能帮忙吗