IE浏览器中使用js调用cmd命令行demo
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 5 <title> 6 js调用cmd命令行 7 </title> 8 </head> 9 10 <body onLoad="win_run()"> 11 </body> 12 <script type="text/javascript"> 13 function win_run() { 14 var cmd = new ActiveXObject("WScript.Shell"); 15 cmd.run("ping baidu.com -t"); 16 } 17 </script> 18 19 </html>