<ADDINS require="CmdShell"></ADDINS>
//打开本地计算器
exec('calc.exe')
///使用IE打开百度网站
exec('"C:\\Program Files\\Internet Explorer\\iexplore.exe" "http://www.hisui.cn"');
//使用IE打开hisui.cn
exec('"%PROGRAMFILES%\\Internet Explorer\\iexplore.exe" "http://www.hisui.cn"');
//使用chrome打开hisui.cn
exec('"%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Google Chrome.lnk" "http://www.hisui.cn"');
//使用chrome打开hisui.cn
exec('"%LOCALAPPDATA%\\Google\\Chrome\\Application\\chrome.exe" "http://www.hisui.cn"');
exec('"%USERPROFILE%\\desktop\\东华系统.lnk" "https://www.hisui.cn"');
Window操作系统下有以下特性
环境变量 真实路径 APPDATA C:\Users\用户名\AppData\Roaming LOCALAPPDATA C:\Users\用户名\AppData\Local PROGRAMFILES C:\Program Files
function exec(command) {
if (websys_isIE){
window.oldOnError=window.onerror;
window._command=command;
window.onerror= function(err){
if(err.indexOf('utomation')>-1) {
alert('命令'+window._command+'已经被用户禁止!');
return true;
}else{
return false;
};
};
var wsh=new ActiveXObject('WScript.Shell');
if (wsh) {
wsh.Run(command);
}
window.onerror = window.oldOnError;
}else{
if (CmdShell){
CmdShell.clear();
CmdShell.notReturn=1;
CmdShell.Run(command);
}
}
}
&
,||
,<
,>
为有意思的特殊字符要加^
来转义,如果使用双引号”包裹内容则不用转义,cmd('"xx.exe" abc.com?a=1^&b=2')
或cmd('"xx.exe" "abc.com?a=1&b=2"')
访问量: 509903