Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run an .exe or .bat file on 'onclick' in HTML

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

like image 571
VSr Avatar asked Sep 24 '13 11:09

VSr


People also ask

How do I run a .BAT file from html?

Just create a batch file and save in the location where your html file is there. this anchor tag will execute the (test. bat) batch file. After clicking on the link <TEST>, you will get the window prompting to open/save/close, if you will click on open then batch file will be executed.

How do I run a batch file from html or Javascript?

The simplest way is like this (this is somewhat close to what you tried already): var wshShell = new ActiveXObject("WScript. Shell"); wshShell. Run("D:\\dir\\user.

Can we make executable software in html?

HTML Executable is a versatile HTML compiler ("html to exe" or "pdf to exe"): it lets you transform entire websites, HTML documents, PDF files and their companion files into real software .exe files. End users run the compiled software as easily as they would run any EXE file.

Can you turn a .bat into an exe?

Converting BAT Scripts to EXE with Bat To Exe Converter If you're not into performing tedious steps like IExpress, a popular third-party tool converts . bat to .exe file and is more effective and convenient. Bat To Exe Converter is a free yet handy tool that quickly converts one or several .


2 Answers

No, that would be a huge security breach. Imagine if someone could run

format c: 

whenever you visted their website.

like image 55
tckmn Avatar answered Oct 01 '22 16:10

tckmn


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 

The HTML code was:

<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)

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.

like image 41
Chuff Avatar answered Oct 01 '22 18:10

Chuff