找回密码
 立即注册
即日起,论坛关闭新用户注册和登录,论坛相关的贴子保留查阅和下载。获得授权后,有技术问题可联系微信 13199509559 一对一解决。 2024-3-12
查看: 1266|回复: 0
打印 上一主题 下一主题

通过html打开本地exe

209

主题

209

主题

209

主题

管理员

Rank: 9Rank: 9Rank: 9

积分
0
跳转到指定楼层
1#
 楼主| admin 发表于 2023-3-25 17:20:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. Windows Registry Editor Version 5.00
  2. [HKEY_CLASSES_ROOT\zyhtest]
  3. @="zyhtest"
  4. "URL Protocol"=""

  5. [HKEY_CLASSES_ROOT\zyhtest\DefaultIcon]
  6. @="F:\\Zyh\\vc++demo\\test_websocket\\Debug\\test_websocket.exe"

  7. [HKEY_CLASSES_ROOT\zyhtest\shell]
  8. [HKEY_CLASSES_ROOT\zyhtest\shell\open]

  9. [HKEY_CLASSES_ROOT\zyhtest\shell\open\command]
  10. @="F:\\Zyh\\vc++demo\\test_websocket\\Debug\\test_websocket.exe"
复制代码
1、新建一份txt,写入以下内容,其中 zyhtest 为自定义名字,exe路径记得改为自己本地exe的路径。然后将txt后缀改为reg,并双击运行。之后打开注册表可以在相应位置看到刚刚的内容。
2、新建一份html,写入以下内容,zyhtest 记得改成自己的名称,并带上://
之后双击运行html,会弹出弹窗,点击即可运行自己的程序。
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.         <meta charset="UTF-8">
  5.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.         <title>open exe</title>
  7.         <style>
  8.                 a{font-size: 30px;text-decoration: none;}
  9.         </style>
  10. </head>

  11. <script type="text/javascript">
  12.         function run(){
  13.                 document.getElementById("autorun").click();
  14.         }
  15. </script>

  16. <body onload="run()">
  17.         <a href="zyhtest://"><span id="autorun"></span></a>
  18.         <hr/>
  19. </body>
  20. </html>
复制代码


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表