花褪残红青杏小。燕子飞时,绿水人家绕。

网页调用本地exe

软件技巧 十五楼的鸟儿 20080浏览 0评论
今天给学校弄局域网的时候用到的,貌似还不错。
<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>&nbsp;
</code>

转载请注明:鸟儿博客 » 网页调用本地exe

与本文相关的文章

游客
发表我的评论 换个身份
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址