Wednesday 23 May 2007

ASP.NET/Java/ASP - Run External File

This is code I use in an Intranet to execute a file on a server. Just place it in the Head of the page:




SCRIPT Language="JScript"

function openOutlook() {
myfile="R:\\Shortcuts\\Outlook.lnk";
WSH=new ActiveXObject("WScript.Shell");
WSH.Run(myfile)
}

/SCRIPT



Remember to add the < and />'s!

Now simply call a href with javascript:openOutlook and voila! Also note that the path MUST have \\ and NOT a single \

No comments: