admin管理员组

文章数量:1535045

使用Url Protocol,可以将某程序注册为自定义协议,通过协议直接调用该程序。以下来看看如何在浏览器直接调用本地程序。

1.准备注册表文件

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\testprotocol]
"URL Protocol"="C:\\xxx\\xxx.exe"
@="testprotocol"

[HKEY_CLASSES_ROOT\testprotocol\DefaultIcon]
@="C:\\xxx\\xxx.exe,1"

[HKEY_CLASSES_ROOT\testprotocol\shell]

[HKEY_CLASSES_ROOT\testprotocol\shell\open]

[HKEY_CLASSES_ROOT\testprotocol\shell\open\command]
@="\"C:\\xxx\\xxx.exe\" \"%1\""

其中testprotocol为协议名称,可自定义。C:\\xxx\\xxx.exe为你的程序路径,需要你自行定义。

将修改好的代码写入txt文件中

然后再将后缀改为reg

双击执行,可能会需要给权限(因为涉及到修改注册表),一路确认即可。

2.在浏览器中使用

将testprotocol://输入到浏览器网址处

结果如下

本文标签: 浏览器直接调用程序如何在exe