function hello () ...{ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); file.initWithPath("D:\program files\foobar2000\foobar2000.exe"); file.launch(); }
script>
上面的代码,执行未加参数的程序;下面的代码,执行添加了参数的程序。
function hello() ...{ var oURL ="";
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var process = Components.classes['@mozilla.org/process/util;1'].getService(Components.interfaces.nsIProcess); var targetFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);