javascript - 如何从jsp中找到安装程序路径?
问题描述
当用户访问我的网站并单击按钮时,我想启动 Postman.exe。所以我必须找到 Postman 安装路径。我使用 ocx 和 regedit commond 找到安装路径。但是如果程序不写注册表的信息,如何找到并启动程序?我可以使用 bat 命令吗?
function exec () {
var command;
var shell = new ActiveXObject("WScript.Shell");
try
{
command = shell.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Directory\\shell\\RadiAnt\\Icon");
}
catch(e)
{
if(window.confirm("你可能还没有安装Radiant,请下载安装")){
//alert("确定");
window.location.href="jspView/radiantsetup32312921.exe";
return false;
}else{
return false;
}
}//执行exe程序
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('命令' + window._command + ' 已经被用户禁止!');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run("\""+command);
window.onerror = window.oldOnError;
}
解决方案
推荐阅读
- angular - 在 Angular 中一次创建一些组件
- actionscript-3 - 如何防止 UI 在调用进程时锁定在 AIR 中?
- javascript - 代码第一次不起作用。无法解决问题
- node.js - 找不到“内容”命令
- git - 如何用另一个分支的提交覆盖旧提交?
- c++ - 使用这些原子操作与内存顺序放松和 rel/acq 如图所示,这个 C++ 片段是否有效?
- python - 如何调试停止的`ProcessPoolExecutor`?
- php - 如何搜索两个以上的关键字?
- mysql - 我们可以在 mysql 组复制中使用 REPEATABLE-READ 隔离级别吗?
- php - FB Marketing API - 支付系统被屏蔽,但广告账户没问题