Jump to content

How to run a .exe file using javascript?


fmpfmpf

Recommended Posts

This thread is a continuation from the following threadhttp://w3schools.invisionzone.com/index.php?showtopic=34951Since this thread deals with something else, i decided to open a new threadThe bottom are my codes<html><head><script type="text/javascript" language="JavaScript">function LaunchCommand(){var myloc = window.location.href;var locarray = myloc.split("/");delete locarray[(locarray.length-1)];var arraytext = locarray.join("/");var launcher = new ActiveXObject("WScript.Shell");launcher.Run(arraytext + "ColorCop.exe");}</script></head><body><center><input name="Command" value="RGB Farbe"onclick="LaunchCommand()" type="button" style="width:200px;height:100px"><body><center></html>Firstly, the above are codes for ABC.html.With this, as long as ColorCop.exe and ABC.html are in the same folder, the codes will work.In this scenario, i have 2 comps.Comp A contains ColorCop.exe and the ABC.html. Comp B would access ABC.html to open ColorCop.exe in Comp A.However, instead of Comp B opening ColorCop.exe, Comp B will attempt to download it instead.However, it works when i place ColorCop.exe in Comp A in Desktop and changed the codes to:function LaunchCommand(){var launcher = new ActiveXObject("WScript.Shell");launcher.Run("ColorCop.exe");}Is there a way to make Comp B open ColorCop.exe in Comp A without placiong ColorCop.exe in the desktop?TQ

Link to comment
Share on other sites

maybe just a direct link to the file itself where it is located on your file system? This would probably force the browser to open a download box where they can save the file and run it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...