MyTetra Share
Делитесь знаниями!
How to launch an EXE from Web page (
Время создания: 11.07.2018 11:59
Текстовые метки: windows launch exe from web page
Раздел: Windows
Запись: Velonski/mytetra-database/master/base/15312923654cf1wgsfi9/text.html на

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. web-applications internet-explorer-7

shareimprove this question

asked May 27 '09 at 17:04



Real answers are here:… – pdem Jan 11 '17 at 9:19

add a comment

8 Answers

active oldest votes

up vote


down vote


How about something like:

<a href="\\DangerServer\Downloads\MyVirusArchive.exe"

type="application/octet-stream">Don't download this file!</a>

shareimprove this answer

answered May 27 '09 at 17:09




-1 -- This would download the exe each time. Would require the download and installation steps each time. But the question is how to run an exe that is already on the user's machine. An entirely different kettle of fish. – Larry K May 27 '09 at 17:26


@Larry: I think you are mistaken in your interpretation. In my opinion, the OP is saying that the executables are produced by them (maybe a particular department in the organization) and need to be available for download and subsequent execution to the entire organization. – Cerebrus May 27 '09 at 17:32

If you are looking to launch an app on the users desktop when they click a link or button on a webpage, and your desktop apps are in .NET then you may want to look into using ClickOnce to deploy the apps. ClickOnce will ease the pain of distributing application in this manor. – Chris Pietschmann May 27 '09 at 23:21

I love that this is the answer! Its obviously exactly what the OP was looking for! haha – Matt Feb 22 '10 at 11:28

Not even funny, the user is asking if he can run an application installed in his machine! just answering "yes, it can be done" or "no, it is not possible" will do. No need to prove you are more clever than everybody else! – user1536396 Nov 19 '13 at 14:40


-1: I got here when I saw you can open a new instance of Visual Studio from the TFS web interface. The question is not asking how to download an EXE but how to launch an installed program. – Marques Dec 4 '13 at 20:11


not funny at all. what the OP is asking is actually very common use case in intranet web apps – Ike Feb 23 '16 at 21:04

add a comment

up vote


down vote

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

<a href="javascript:LaunchApp()">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).

shareimprove this answer

edited Nov 5 '14 at 23:39

Cristian Ciupitu


answered Feb 18 '11 at 23:56



This works great! For anyone needing to launch an app from a UI and can afford to limit distribution to IE, this is far easier than building a UI in .NET or Qt, etc. Also great for writing UIs to test EXEs. – Brent Faust Mar 27 '12 at 5:12


how can we launch chrome like above way ? – Ganesh Oct 30 '14 at 16:39


ActiveXObject worked only for IE – ashkufaraz Mar 18 '17 at 9:13

add a comment

up vote


down vote

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

It downloads a js file

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

If iTunes is installed then the browser is redirected to an URL with a special transport: itms://...

The browser invokes the handler (provided by the iTunes exe). This includes starting up the exe if it is not already running.

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.

shareimprove this answer

edited Nov 5 '14 at 23:13

Cristian Ciupitu


answered May 27 '09 at 17:24

Larry K


add a comment

up vote


down vote

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 Files\Alert\alert.exe"

Then you can write a html to test





<a href="alert:" >alert</a>


shareimprove this answer

answered Nov 13 '15 at 9:11



add a comment

up vote


down vote

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

shareimprove this answer

edited May 23 '17 at 11:54



answered Feb 22 '10 at 11:06


add a comment

up vote


down vote

Did you try a UNC share?


shareimprove this answer

answered May 27 '09 at 17:06

Andrew Hare


add a comment

up vote


down vote

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:\inetpub\wwwroot, 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);



shareimprove this answer

edited May 28 '09 at 1:32

answered May 27 '09 at 22:36



Yes, very good answer and thanks for reminding me. However, the EXE loads config settings from its load folder so I would have to rewrite to load from the Web site config. – JoeJoe May 27 '09 at 23:11

An alternative is to package the actual app along with its config file and anything else it needs, in a self-extracting zip archive (SFX), and then download THAT. The SFX can specify an execute-after-unpack command, which could be the command of the file unpacked. It would then be able to load its .config normally. The problem with this is, of course, that you would cut the cord. You cannot update the config centrally. Once it is copied to the user's HD, it is there to stay. – Cheeso May 28 '09 at 1:32

ps: DotNetZip is a (free) .NET library that allows the creation of self-extracting archives, with an execute-after-unpack command. You could, within the execution of the ASP.NET page, dynamically create the SFX, and then download it to the user's HD with TransmitFile(). – Cheeso May 28 '09 at 1:34

I like your style – JoeJoe Jun 1 '09 at 17:41

add a comment

up vote


down vote

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.


Так же в этом разделе:
MyTetra Share v.0.58
Яндекс индекс цитирования