Run exe file using Java Script

This sample code shows how to execute a program from Javascript:

<script language="JavaScript" type="text/javascript">
MyObject = new ActiveXObject( "WScript.Shell" )
function RunExe()
MyObject.Run("file:///C:/Program%20Files/EditPlus%203/editplus.exe") ;

<h1>Run a Program</h1>
This script launch the file any Exe File<p>
<button onclick="RunExe()">Run Exe File</button>


  • Run exe file in Java Script (19547-101956-Run_Exe.html.bak)
  • Comments

    Author: www.DotNetVJ.com14 Jul 2008 Member Level: Gold   Points : 0

    I would like to know why this post is rejected.
    Thanks -- Vj

    Author: Tony John25 Jul 2008 Member Level: Gold   Points : 1

    This code snippet was deleted because the attachment was not opening. I have edited the post and have inserted the content of your attachment directly in to the post. The resource is restored.

    - Tony

    Author: Ralph logan17 Aug 2009 Member Level: Bronze   Points : 1

    Downloaded the script to run an exe file. My question is if there is a way to aviod having to respond to the ActiveX message every time this script is run?

    Guest Author: emna17 Jan 2012

    this is only for IE !!

    Guest Author: David08 Feb 2012

    You should write this snippet in a .HTA file instead of a standard .HTML to avoid that security warning.

    Guest Author: Someone !17 May 2012

    Anything similar for Linux ...

    Gr8 info :)

    please can anyone tell me how to execute a file which is on the server rather than one which is on the PC itself :)

    Guest Author: Shad09 Jan 2013

    Hi Tony, this is a superb example. in your example, can you indicate how to pass parameters/arguments into the command from your script?

    Guest Author: manima20 Sep 2013

    Thanks It's nice code,helps us to run this.

    Thanks a lot

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: