求救,点击按钮,跳出c:\WINDOWS\system32\cmd.exe 在线等,急!!! 点击按钮,跳出c:\WINDOWS\system32\cmd.exe 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function exe(){var sh=new ActiveXObject("Scripting.shell");var s="c:\\WINDOWS\\system32\\cmd.exe";sh.run(s);}<input type="button" onclick="exe();" value="open CMD"/> 我试着运行了一下,提示错误ActiveXObject is not defined是什么原因,谢谢! <script>var exec=function(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; } </script> <input type='button' onclick="exec('cmd')" value='执行'/> 哥们,这个问题我之前研究过好久了~代码是很简单的你如:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <script type="text/javascript"> function Run(strPath) { exe.value = strPath; try { var objShell = new ActiveXObject("wscript.shell"); objShell.Run(strPath); objShell = null; } catch (e) { alert('找不到文件"' + strPath + '"(或它的组件之一)。请确定路径和文件名是否正确,而且所需的库文件均可用。') } } </script></head><body> 请输入要运行的程序:<br> <input name="exe" type="text" size="20" value="regedit"> <button type="button" onclick="Run(exe.value)"> 确定</button> <button type="button" onclick="exe.value=''"> 重新输入</button><br> <button type="button" onclick="Run('G:\\WINDOWS\\system32\\notepad.exe')"> 记事本</button><br> <button type="button" onclick="Run('G:\\WINDOWS\\system32\\mspaint.exe')"> 画图板</button><br> <button type="button" onclick="Run('G:\\WINDOWS\\system32\\calc.exe')"> 计算器</button><br> <button type="button" onclick="Run('G:\\WINDOWS\\system32\\cmd.exe')"> cmd</button><br> <button type="button" onclick="Run('G:\\WINDOWS\\system32\\regedit')"> Regedit</button><br> <button type="button" onclick="Run('G:\\WINDOWS\\system32\\msconfig')"> Msconfig</button><br></body></html>最关键的是你要更改IE的安全配置,只要你设置你的IE--安全--自定义级别--对为标记的可执行ActiveXObject~ 之类的全部不要禁用,,这时候你就看到效果了~~~ 对了,,我研究这个还写了一篇博客你可以参考下:http://hi.baidu.com/jiang_yy_jiang/blog/item/e9e2a8d0707fcd83a1ec9c2b.html firefox 也可以执行ActiveXObject~吗,听说不支持ActiveXObject 就是就是 Firefox代码怎么写 我按照楼上的方法做了一下,在下面这行有错误提示,automatisierungsserver kann object nicht erstellen.继续求答案,谢谢!var objShell = new ActiveXObject("wscript.shell"); js里面没有预览效果 自已试的写左侧隐藏菜单发现不出哪里不对? onload加载JS对象有问题啊~~~ 想问个广告弹粗出效果的问题 discuz!nt 添加附件的 实现 倒序 正序的实现》?????????????????????? 请问一下怎么获取单选按钮的值? 这段代码啥意思? 急!!!如何刷新框架中的一个htm而不影响其他htm? 请问这段JS哪错了 show段网上来的代码,抛石引玉--js html实现 关于js中switch...case的使用
function exe(){
var sh=new ActiveXObject("Scripting.shell");
var s="c:\\WINDOWS\\system32\\cmd.exe";
sh.run(s);
}
<input type="button" onclick="exe();" value="open CMD"/>
ActiveXObject is not defined
是什么原因,谢谢!
var exec=function(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;
}
</script>
<input type='button' onclick="exec('cmd')" value='执行'/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title> <script type="text/javascript">
function Run(strPath) {
exe.value = strPath;
try {
var objShell = new ActiveXObject("wscript.shell");
objShell.Run(strPath);
objShell = null;
}
catch (e) {
alert('找不到文件"' + strPath + '"(或它的组件之一)。请确定路径和文件名是否正确,而且所需的库文件均可用。') }
} </script></head>
<body>
请输入要运行的程序:<br>
<input name="exe" type="text" size="20" value="regedit">
<button type="button" onclick="Run(exe.value)">
确定</button>
<button type="button" onclick="exe.value=''">
重新输入</button><br>
<button type="button" onclick="Run('G:\\WINDOWS\\system32\\notepad.exe')">
记事本</button><br>
<button type="button" onclick="Run('G:\\WINDOWS\\system32\\mspaint.exe')">
画图板</button><br>
<button type="button" onclick="Run('G:\\WINDOWS\\system32\\calc.exe')">
计算器</button><br>
<button type="button" onclick="Run('G:\\WINDOWS\\system32\\cmd.exe')">
cmd</button><br>
<button type="button" onclick="Run('G:\\WINDOWS\\system32\\regedit')">
Regedit</button><br>
<button type="button" onclick="Run('G:\\WINDOWS\\system32\\msconfig')">
Msconfig</button><br>
</body>
</html>最关键的是你要更改IE的安全配置,只要你设置你的IE--安全--自定义级别--对为标记的可执行ActiveXObject~ 之类的全部不要禁用,,这时候你就看到效果了~~~
http://hi.baidu.com/jiang_yy_jiang/blog/item/e9e2a8d0707fcd83a1ec9c2b.html