How to launch an EXE from Web page (

This is an internal web application where we would like the Web pages to contain links to several utilities that are Win32 EXE. The EXEs are trusted and produced by us. (don’t care if it asks if its ok to Run or Save). I tried direct link (e.g. C:notepad.exe) which works locally only. (This will be a share on the network). Tried File:/// and did not work.
IE7 is the browser needed.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

This assumes the exe is somewhere you know on the user’s computer:

<a href="javascript:LaunchApp()" rel="nofollow noreferrer noopener">Launch the executable</a>

function LaunchApp() {
if (!document.all) {
  alert ("Available only with Internet Explorer.");
var ws = new ActiveXObject("WScript.Shell");

Documentation: ActiveXObject, Exec Method (Windows Script Host).

Method 2

How about something like:

<a href="\DangerServerDownloadsMyVirusArchive.exe" rel="nofollow noreferrer noopener" 
  type="application/octet-stream">Don't download this file!</a>

Method 3

You can see how iTunes does it by using Fiddler to follow the action when using the link:

  1. It downloads a js file
  2. On windows: the js file determines if iTunes was installed on the computer or not:
    looks for an activeX browser component if IE, or a browser plugin if FF
  3. If iTunes is installed then the browser is redirected to an URL with a special transport: itms://…
  4. The browser invokes the handler (provided by the iTunes exe). This includes starting up the exe if it is not already running.
  5. iTunes exe uses the rest of the special url to show a specific page to the user.

Note that the exe, when installed, installed URL protocol handlers for “itms” transport with the browsers.

Not a simple engineering project to duplicate, but definitely do-able. If you go ahead with this, please consider making the relevant software open source.

Method 4

In windows, specified protocol for application can be registered in Registry.
In this msdn doc shows Registering an Application to a URI Scheme.

For example, an executable files ‘alert.exe’ is to be started. The following item can be registered.

      (Default) = "URL:Alert Protocol"
      URL Protocol = ""
         (Default) = "alert.exe,1"
               (Default) = "C:Program FilesAlertalert.exe"

Then you can write a html to test


    <a href="alert:" rel="nofollow noreferrer noopener" >alert</a>

Method 5

As part of the solution that Larry K suggested, registering your own protocol might be a possible solution.
The web page could contain a simple link to download and install the application – which would then register its own protocol in the Windows registry.

The web page would then contain links with parameters that would result in the registerd program being opened and any parameters specified in the link being passed to it.
There’s a good description of how to do this on MSDN

Method 6

Did you try a UNC share?


Method 7

Are you saying that you are having trouble inserting into a web page a link to a file that happens to have a .exe extension?

If that is the case, then take one step back. Imagine the file has a .htm extension, or a .css extension. How can you make that downloadable? If it is a static link, then the answer is clear: the file needs to be in the docroot for the ASP.NET app. IIS + ASP.NET serves up many kinds of content: .htm files, .css files, .js files, image files, implicitly. All these files are somewhere under the docroot, which by default is c:inetpubwwwroot, but for your webapp is surely something different. The fact that the file you want to expose has an .exe extension does not change the basic laws of IIS physics. The exe has to live under the docroot. The network share thing might work for some browsers.

The alternative of course is to dynamically write the content of the file directly to the Response.OutputStream. This way you don’t need the .exe to be in your docroot, but it is not a direct download link. In this scenario, the file might be downloaded by a button click.

Something like this:

    string FullPathFilename = "\\server\share\CorpApp1.exe";
    string archiveName= System.IO.Path.GetFileName(FullPathFilename);
    Response.ContentType = "application/octet-stream";
    Response.AddHeader("content-disposition", "filename=" + archiveName);

Method 8

if the applications are C#, you can use ClickOnce deployment, which is a good option if you can’t guarentee the user will have the app, however you’ll have to re-build the apps with deployment options and grab some boilerplate code from each project.

You can also use Javascript.

Or you can register an application to handle a new web protocol you can define. This could also be an “app selection” protocol, so each time an app is clicked it would link to a page on your new protocol, all handling of this protocol is then passed to your “selection app” which uses arguments to find and launch an app on the clients PC.


All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x