注册表的方式
使用注册表的方式,通过注册表协议即可调用相应的桌面exe
- 如在浏览器输入
vscode://
,回车之后即可出现如下的页面

如何编写一个注册表
1.编写reg
文件,定义注册表的协议及目标exe的文件位置
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\toy]
"URL Protocol"=""
@="URL:toy"
[HKEY_CLASSES_ROOT\toy\shell]
[HKEY_CLASSES_ROOT\toy\shell\open]
[HKEY_CLASSES_ROOT\toy\shell\open\command]
@="\"D:\\下载\\ChromeSetup.exe\" \"%1\""
2. 点击toy.reg
,出现如下界面

3. 在注册表中查看

4. 浏览器中输入toy://
, 出现
5. 页面中调用
const aLink = document.createElement('a');
aLink.href = 'toy://startSession';
document.body.append(aLink);
setTimeout(() => {
aLink.click();
document.body.removeChild(aLink);
}, 100);
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。