If I am making an auto-run CD for windows, can I specify which program should open the file? I want to autorun an index.html page and if possible force it to open in Inet Explorer rather than Netscape if they have that installed. I realise if I just autorun it will use whatever program is associated with the filetype, but this is what I want to override.
// Set startdoc to a quoted string which is the absolute path to
// your HTML document, omitting the drive designator.
// Note that backslashes must be escaped with another backslash, so path seperators are "\\"
var startdoc = "\\contents\\index.html"
var shell = WScript.CreateObject("WScript.Shell");
// LaunchDocInIExplore() looks for the reg key with the location of the iexplore executable,
// and if it finds it, launches it with the specified doc as a parameter.
// Returns true if successful, false otherwise
var handler = shell.RegRead(
if(!handler || handler == "")
var iepath = "";
// if it's quotated, use the part in quotes.
// if not, return the part up to the first space, quoted
if(handler.charAt(0) == "\"")
var nextquote = handler.indexOf("\"", 1);
var exename = handler.substr(0, nextquote+1);
iepath = exename;
var splithandler = handler.split(" ");
iepath = "\"" + splithandler + "\"";
if(false && iepath && iepath != "")
var runstr = iepath + " \"" + doc + "\"";
return (shell.Run(runstr) == 0);
// LaunchDoc() simply runs the doc, allowing the
// default handler for this file type to take over
shell.Run("\"" + doc + "\"");
WScript.Echo("Error creating WScript.Shell object.");
// first try IE
// if that failed, just launch it