<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title><script language="javascript">function exe(){
var sh=new ActiveXObject("Scripting.shell");
var s="c:\\WINDOWS\\system32\\cmd.exe";
sh.run(s);
}
</script>
</head>
<body>
<input type="button" onclick="exe();" value="open CMD"/>
</body>
</html>运行以上代码的时候报“Automation服务器不能创建对象”的错误,请问这是什么错误?
怎样解决?
我在本地测试的,并没有传到服务器上测试。
还是全都启用?
页面--> 工具--> Internet选项--> 安全--> 自定义级别--> 对未标记为可安全执行脚本的ActiveX控件初始化并执行脚本改为启动。默认是不启用
改为var sh=new ActiveXObject("WScript.shell");试一试
Shell的话,可以用 WScript.Shellvar sh = new ActiveXObject("WScript.Shell");sh.Run( ... );