可以在HTML中的“onclick”上运行.exe或.bat文件 [英] Is it possible to run an .exe or .bat file on 'onclick' in HTML
问题描述
是否可以使用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 "\\server\Software\" 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屋!