# how to execute .bat file from html page



## andrew55

I think this is the correct place to post this topic. I have a java program which was created for users to download from our website (as a zip) and then run from their computer (after it's unzipped). The program runs a simple audio exercise. 

Currently, the program has to be run by clicking a .bat file (start.bat) which is located inside the folder that contains the whole program.

Instead of the user having to double click on the .bat file, I am trying to create a simple html page that has a link (or button) such as "start program now" 

So the user opens the folder, clicks on the html page to open it in their browser (as a local file), and clicks the link on the page and the bat file is executed. 

I have some experience with html and php, but have no clue how to execute a bat file from a local html page. Is there a script I need to make this work? ? I know I've seen this done before - I just can't seem to find anything on the net about how to do it! Help please! Any suggestions greatly appreciated.


----------



## dukevyner

found this


> WshShell = new ActiveXObject("WScript.Shell");
> WshShell.Run("explorer file:///D:\\temp\\1.bat",1,true);
> 
> http://msdn.microsoft.com/en-us/library/d5fk67ky.aspx


looks to be the only way... sorry

Hope this helps

-Luke


----------

