JavaScript 调用CMD命令
JavaScript 调用CMD命令
2011年09月01日
以下文件保存为 *.js
WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("cmd.exe");
WScript.Sleep(1000);
WshShell.AppActivate("cmd.exe");
WScript.Sleep(1000);
WshShell.AppActivate("Telnet 8.1.91.110");
WshShell.SendKeys("telnet 8.1.91.110{ENTER}");
WshShell.SendKeys("tftp 8.1.78.74 get 001.CC{ENTER}");
WshShell.SendKeys("startup system-software 001.CC{ENTER}");
WshShell.SendKeys("reboot{ENTER}");
WshShell.SendKeys("y{ENTER}");
WshShell.SendKeys("y{ENTER}");
WScript.Sleep(1000);
然后写一批处理:
cscript *.js
http://www.shareba.com/Article/ShowArticle.asp?Art icleID=984