js方法
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); } }
html调用
<a href="#" onclick="Run('CHelloWord3.exe')">RUN EXE</a>