js调用本地 exe

function Run(strPath)  //only for ie
{   
           try   
           {   
             var objShell = new ActiveXObject("wscript.shell"); 
             objShell.CurrentDirectory="E:\\YOURPATH\\C++\\CHelloWord 3\\Debug\\";
             //设置当前路径很重要,能让exe程序解决 相对路径问题 (否则会在html所在路径找)
             objShell.Run(strPath);   
             objShell = null;   
           }  catch(e){ 
                alert(e.message);  
           }   
 
} 
    
<a href="#" onclick="Run('CHelloWord3.exe')">RUN EXE</a>   

猜你喜欢

转载自www.cnblogs.com/yachao1120/p/10613755.html
今日推荐