网页调用本地exe
<code>
New Document
<meta name="Generator" content="EditPlus" />
<meta name="Author" content="" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<script type="text/javascript">// <![CDATA[
function killErrors(){
alert("请将您浏览器Internet选项中的“对没有标记为安全的ActiveX控件进行初始化和脚本运行”设置为“启用”!\n\n然后刷新本页登陆!");
return true;}
//window.onerror = killErrors;
String.prototype.replaceAll = replaceAll;
function replaceAll(AFindText,ARepText){
raRegExp = new RegExp(AFindText,"g");
return this.replace(raRegExp,ARepText);
}
function exec (command)
{
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function(err)
{
if (err.indexOf('utomation') != -1)
{
alert('命令已经被用户禁止!');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh) {
wsh.Run(command);
}
// window.onerror = window.oldOnError;
// alert(window.oldOnError);
}
function execByReg(regValue, appValue) {
var obj = new ActiveXObject("WScript.Shell");
var path = "file:///" + obj.RegRead(regValue)+ appValue;
path = path.replace(new RegExp(' ', 'g'), '%20');
path = path.replace(new RegExp('\\\\', 'g'), '/');
alert(path)
exec(path)
}
// ]]></script>
<form action="#" method="post" name="form1"><a onclick="exec('%windir%/system32/calc.exe')" href="#">计算器
</a><a onclick="exec('%windir%/system32/notepad.exe')" href="#">写字板
</a><a onclick="exec('file:///E:/Program%20Files/Foxmail/Foxmail.exe')" href="#">邮件
</a><a onclick="exec('file:///D:/Program%20Files/Microsoft%20OFFICE/OFFICE11/WINWORD.EXE')" href="#">word
</a><a onclick="execByReg('HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\11.0\\Word\\InstallRoot\\Path', 'WINWORD.EXE')" href="#">word2003
</a><a onclick="exec('file:///E:/Microsoft%20Office/OFFICE11/EXCEL.EXE')" href="#">excel2
</a>
</form>
</code>