Board logo

html code to launch an .exe on a local machine
mads - 30/4/09 at 06:17 PM

Need some help after browsing the net and not finding quite what I am after...

I am creating an intranet site and want to launch a program by the user clicking a button on the intranet site. How can I do this without the user being asked if they want to save or run the program?

I am aware of the security risks of such coding but as said it is for intranet site and local users only.

Any suggestions?


blakep82 - 30/4/09 at 06:26 PM

hmm, i'm not entirely sure you can, as the application you want to run could be installed in any folder. ie it may not be in the specific place the code points it to.

it could be in c:windowsprograms, or it could be in c:windowsusers for example

i mean, it probably can be done, but might not be that reliable.


[Edited on 30/4/09 by blakep82]


Worzey - 30/4/09 at 06:33 PM

I'm sure you can't do this.

The browser security settings will always ask the user.


mads - 30/4/09 at 06:35 PM

That's what I'm thinking Worzey but I thought I'd ask here in case anyone has some bright ideas on how to do it before I give up.


blakep82 - 30/4/09 at 06:37 PM

what is it you're trying to run anyway?


fov - 30/4/09 at 06:39 PM

You could do it with with ActiveX. Though I bet Vista would be a PITA. Plus you would have to use IE.
Is this a domain? Can you GP the intranet into the trusted sites?

Tell us a bit more about your environment and what your running and we may be able to come up with a more elegant solution.


madmandegge - 30/4/09 at 08:06 PM

Are you using IIS on the server? If so, you can quite simply setup a "virtual drive" which points to the folder on the server, and will make it available via a URL, then all you'd need to enter would be.

http://myserver/setup.exe

If you aren't use IIS, download it and install it from Microsoft's site! And this will work on Firefox too.



edit - thinking about your problem, doing the above then just pointing a link towards the URL you have, as above, should do the trick.

edit #2 - just thought about this and it's not ideal as it's running from the server! what program are you trying to run

[Edited on 30/4/09 by madmandegge]


mads - 30/4/09 at 08:12 PM

Environment: 2 laptops with Microsoft XP installed.

Program: database program which the end users access to retrieve or enter info (call logging program almost)

Intranet site: pages that contain info the end user would need when they are using the laptop. The laptop will be used for nothing else other than looking at that info when it is needed.

My plan now is to have the homepage of the intranet site set as an active background from which the users can find whichever page it is they need using the menu buttons. I would still like the program to be loadable from the active background rather than the user having to go via Start > Programs etc... (as well as preferring a clean desktop with no icons)

Could it work if I linked to the shortcut icon of the program?


madmandegge - 30/4/09 at 08:38 PM

Possible with a VBScript

1st link - http://www.visualbasicscript.com/m_22/tm.htm

2nd link (file paths with spaces?) - http://weblogs.asp.net/steveschofield/archive/2004/03/14/89240.aspx

Should be easy enough to change to the location of the file you have?

3rd edit - should probably take my time!

http://www.csidata.com/custserv/onlinehelp/vbsdocs/vbs9.htm

Putting this into the HTML should work

<SCRIPT LANGUAGE="VBScript">
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:myprogram.exe"
</SCRIPT>


[Edited on 30/4/09 by madmandegge]


stevebubs - 30/4/09 at 11:11 PM

simplest answer is to start messing with security zones.

If it's an intranet site then putting the URL into the trusted zone lists will bring the security levels right down....