首页 > 解决方案 > 如何从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;
}  

标签: javascripthtmlinternet-exploreractivexobjectocx

解决方案


推荐阅读