客户端的操作是能调用服务器端的程序,但是没有办法得到服务器端的运行界面的,除非在系统服务中的“登陆”把“允许服务与桌面交互”打勾。但要若要连接到远程的电脑得先进行远程桌面连接,只有这样才能提交显示服务器端的界面效果
我知道的有两个办法解决:1 用JS 2.用APPLET
这里我们用JS的ActiveXObject对象
测试环境: IE8 要把浏览的网站设为“可信任站点”,不然没法调EXE。
下面附上我的JS文件
// JavaScript Document
function startKP() {
RunExe("HKEY_LOCAL_MACHINE\\SOFTWARE\\XX\\XX\\XX\\","XX\\XX.exe");
}
function RunExe(regPath,exeName) {
try{
var WshShell = new ActiveXObject("WScript.Shell");
//regPath=regPath.replace(/\\/g,'\\\\');
var path = WshShell.RegRead(regPath); // 通过对象方法读注册表的值
var pathArr=path.split("\\");
path="";
for(var i=0;i<pathArr.length;i++){
var p=pathArr[i];
if(p.length<=8){
path+=p+"\\\\";
}else{
path+=p.substr(0,6)+"~1\\\\";
}
}
path += exeName;
WshShell.Run(path);
window.setTimeout(function(){WshShell.SendKeys("{ENTER}");},5000);
window.setTimeout(function(){WshShell.SendKeys("{ENTER}");},12000);
window.setTimeout(function(){WshShell.SendKeys("{ENTER}");},16000);
window.setTimeout(function(){WshShell.SendKeys("{ENTER}");},20000);
window.setTimeout(function(){WshShell.SendKeys("{ENTER}");},23000);
// window.setTimeout(function(){WshShell.SendKeys("%F");},17000);
// window.setTimeout(function(){WshShell.SendKeys("{W}");},20000);
// window.setTimeout(function(){WshShell.SendKeys("%A");},21000);
// window.setTimeout(function(){WshShell.SendKeys("{2}");},22000);
}catch(e){
alert(e);
}
}