function exec() {
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("C:/Users/Vision/Desktop/1111.sql");
/**
var batName = "a.bat";
// 获取当前文件的相对路径
//var pathName =window.location.pathname.replace("Test.jsp","");
//var batPath = pathName+batName;
var pathName = window.location;
alert("当前文件路径:"+pathName);
var fileName = pathName.toString().split("/")[pathName.toString().split("/").length-1];
alert("当前文件名:"+fileName);
var targetFile ="a.bat";
pathName = pathName.toString().replace(fileName,targetFile);
alert(pathName);
// 方式一:相对途径
var result = wsh.run(pathName);
// 方式二:绝对途径
//var result = wsh.run("c:/a.bat");
**/
}
window.onerror = window.oldOnError;
}