概述
IE 下执行exe程序 (ActiveX)
-
<a href="javascript:LaunchApp()">Click here to Execute your file</a>
-
<script>
-
function LaunchApp() {
-
if (!document.all) {
-
alert ("This ActiveXObject is only available for Internet Explorer");
-
return;
-
}
-
-
var ws = new ActiveXObject("WScript.Shell");
-
ws.Exec("D:\Software\youfile.exe");
-
}
-
</script>
Firefox 下执行exe程序
-
<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进行打印
最后
以上就是香蕉冬日为你收集整理的IE和Firefox下执行exe程序的全部内容,希望文章能够帮你解决IE和Firefox下执行exe程序所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复