是否可以在 HTML 中的“onclick"上运行 .exe 或 .bat 文件 [英] Is it possible to run an .exe or .bat file on 'onclick' in HTML

查看:36
本文介绍了是否可以在 HTML 中的“onclick"上运行 .exe 或 .bat 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 html5 按钮事件运行 bat/可执行文件?如果我没记错的话,在 IE 中使用 Shell 对象是可以实现的.

Is it possible to run bat/executable file using html5 button event? In IE its achievable using Shell object if I am not wrong.

推荐答案

这是我所做的.我想在我们的网络上设置一个 HTML 页面,这样我就不必导航到各种文件夹来安装或升级我们的应用程序.所以我所做的是在我们每个人都可以访问的共享"驱动器上设置一个 .bat 文件,在该 .bat 文件中我有以下代码:

Here's what I did. I wanted a HTML page setup on our network so I wouldn't have to navigate to various folders to install or upgrade our apps. So what I did was setup a .bat file on our "shared" drive that everyone has access to, in that .bat file I had this code:

start /d "\serverSoftware" setup.exe

HTML 代码是:

<input type="button" value="Launch Installer" onclick="window.open('file:///S:Test/Test.bat')" />

(确保你的斜线是正确的,我用另一种方式,它没有用)

(make sure your slashes are correct, I had them the other way and it didn't work)

我更喜欢直接启动 EXE,但这是不可能的,但是 .bat 文件允许我解决这个问题.希望它适用于 FF 或 Chrome,但仅适用于 IE.

I preferred to launch the EXE directly but that wasn't possible, but the .bat file allowed me around that. Wish it worked in FF or Chrome, but only IE.

这篇关于是否可以在 HTML 中的“onclick"上运行 .exe 或 .bat 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆