目录

前端页面调用本地exe,打开exe主界面

前端页面调用本地exe,打开exe主界面

一、文件配置

在桌面新建文件Start.txt 复制以下内容,保存后修改后缀名.txt为 .reg。

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Start]
"URL Protocol"="D:\\Task\\app.exe"
@="Start Protocol"
[HKEY_CLASSES_ROOT\Start\DefaultIcon]
@="D:\\Task\\app.exe"
[HKEY_CLASSES_ROOT\Start\shell]
[HKEY_CLASSES_ROOT\Start\shell\open]
[HKEY_CLASSES_ROOT\Start\shell\open\command]
@="\"D:\\Task\\app.exe\""

二、双击运行.reg,一路点确认

三、页面打开

浏览器网址输入:Start://,回车,

https://i-blog.csdnimg.cn/direct/ca496ea12810430a91adf867ddaff9bb.png

点击打开app.exe按钮,exe桌面就打开了。

四、前端按钮添加

在前端代码点击函数中输入以下代码

window.location.href = 'Start://'