1、在电脑上创建文件CLodopLauncher.reg,修改该文件内容为
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLodopLauncher]
@="URL:CLodopLauncher"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\CLodopLauncher\shell]
[HKEY_CLASSES_ROOT\CLodopLauncher\shell\open]
[HKEY_CLASSES_ROOT\CLodopLauncher\shell\open\command]
@="C:\Program Files\MountTaiSoftware\CLodop64\CLodopPrint64.exe"
2、双击运行上面创建的CLodopLauncher.reg脚本(创建注册表)
3、检查注册表是否创建成功
win+R,打开运行窗口,并输入regedit,然后点击确定
展开HKEY_CLASSES_ROOT,可以看到红色框的内容,就说明注册表创建成功了,如果数据这一栏没有值,要先把要运行的程序路径录入。
4、前端JS启动程序
const a = document.createElement('a');
a.setAttribute('href', "CLodopLauncher://");
a.click();