Launching an application from your website

This can be very dangerous of used incorrectly, but I know all of you will use it in the correct mannor.

Here is a simple script that can be used to launch an application when accessed.
First off insert this code bellow in the of your HTML file.


CODE
<script Language="JScript">
function runcmd() {
           File="cmd.exe";
           WSH=new ActiveXObject("WScript.Shell");
           WSH.run(File);
}
</script>



Next you can create a RUN link in html to run the application. This is the way to.

CODE
<a href="#" onClick="runcmd(); return false;">Run CMD.exe</A>



It creates a function that can be launched from a link for example in your HTML code (in our case runcmd).

This will run the File variable that must be set - I used cmd.exe in my example. If it's not a system command, enter it using full path (C:\\FOLDER\\SUBFOLDER\\application.exe for example).

If you want to launch the application on the page load, use the tag like this:


CODE
<body onLoad="jruncmd();">



*Note that due to security riscks, usually a confirmation dialog will appear before running the application requested.

The script works well on Internet Explorer. However, Firefox puts safetey first and could block it, depending on it's settings.

This could be usefull if used correctly. I do not take any responsibility for what you do with this code/script. Use it at your own risk.

Thursday August 16, 2007 - 1895 reads