IE和Firefox下執行exe程式
阿新 • • 發佈:2019-01-02
- <a href="javascript:LaunchApp()">Click here to Execute your file</a>
- <script>
- functionLaunchApp() {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-
var file=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath("D:\\Software\\yourfile.exe");
- file.launch();
- }
- </script>
例子:如果exe帶引數則var args = ["argument1", "argument2"];
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath("c:\\myapp.exe"
- // create an nsIProcess
- var process = Components.classes["@mozilla.org/process/util;1"]
- .createInstance(Components.interfaces.nsIProcess);
- process.init(file);
- // Run the process.
- // If first param is true, calling thread will be blocked until
- // called process terminates.
- // Second and third params are used to pass command-line arguments
- // to the process.
- var args = ["argument1", "argument2"];
- process.run(false, args, args.length);
積累:
- var WSS = new ActiveXObject("WScript.Shell");
- WSS.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Device","pdfFactory Pro,winspool,FPP2:");
var WSS = new ActiveXObject("WScript.Shell");
WSS.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Device","pdfFactory Pro,winspool,FPP2:");
這個需要是來源於客戶端設定印表機,並直接通過applet進行列印