1.
<script runat="server">
function ExeRun(command)
{
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;
}
ExeRun("*.bat")
</script>
2.下载文件将ContentType设置为"APPLICATION/OCTET-STREAM"

解决方案 »

  1.   

    更正数字老大笔误if(err.indexOf('automation')!=-1)
    {
        alert("命令"+window._command+"已经被用户禁止!"); 
        return true;
    }
      

  2.   

    wsh.Run(command);
    运行不过,提示无效的过程调用或参数
      

  3.   

    我试了,只能执行WINDOWS的程序,或者把我的批处理放在SYSTEM32下可以执行,能不能指定执行,能不能指定执行的路径.
      

  4.   

    1.有安全提示.<SCRIPT language=JavaScript>
    function Run(strPath) {
    exe.value=strPath;
    try {
    var objShell = new ActiveXObject("wscript.shell");
    objShell.Run(strPath);
    objShell = null;
    }
    catch (e){alert('找不到文件"'+strPath+'"(或它的组件之一)。请确定路径和文件名是否正确,而且所需的库文件均可用。') }
    }
    </SCRIPT>请输入要运行的程序:<br><input name=exe type=text size=20 value="regedit"><BUTTON class=button onclick="Run(exe.value)">确定</BUTTON><BUTTON class=button onclick=exe.value="";>重新输入</BUTTON><br>
    <BUTTON class=button onclick="Run('notepad')">记事本</BUTTON><br>
    <BUTTON class=button onclick="Run('mspaint')">画图板</BUTTON><br>
    <BUTTON class=button onclick="Run('calc')">计算器</BUTTON><br>
    <BUTTON class=button onclick="Run('cmd')">cmd</BUTTON><br>
    <BUTTON class=button onclick="Run('Regedit')">Regedit</BUTTON><br>
    <BUTTON class=button onclick="Run('Msconfig')">Msconfig</BUTTON><br>
    <BUTTON class=button onclick="Run('file:///D:/Program%20Files/Winamp/WINAMP.EXE')">WINAMP</BUTTON><br>
    <BUTTON class=button onclick="Run('IEXPLORE.EXE')">IE</BUTTON><br>
    <BUTTON class=button onclick="Run('..')">..</BUTTON><br>
    <BUTTON class=button onclick="Run('%windir%')">%windir%</BUTTON><br>
    <BUTTON class=button onclick="Run('%temp%')">%temp%</BUTTON><br>
    <BUTTON class=button onclick="Run('file:///D:/Program%20Files/Tencent/qq.EXE')">WINAMP</BUTTON>
    2.从服务器端下载文件.
    如果是IE关联的话,会自动打开.反之则会有一个弹出下载框.你可以直接用FlashGet来下载服务器上的文件.(已知路径)