捆饶N久的telnet自动执行问题
set sh=WScript.CreateObject("WScript.Shell")WScript.Sleep 1000
sh.Run "telnet.EXE"
WScript.Sleep 1000
sh.SendKeys "open 10.0.0.1"
WScript.Sleep 1000
sh.SendKeys "{ENTER}"
WScript.Sleep 1000
sh.SendKeys "root{ENTER}"
WScript.Sleep 1000
sh.SendKeys "pass{ENTER}"
WScript.Sleep 2000
sh.SendKeys "pwd{ENTER}"
......
sh.SendKeys "exit{ENTER}"
WScript.Sleep 1000
sh.SendKeys "{ENTER}"
WScript.Sleep 1000
sh.SendKeys "quit{ENTER}"
上面是可以利用telnet自动登陆的代码,可以帮助我自动完成一些命令,现在有个问题:当telent窗口失去焦点的时候(比如突然有个窗口跳出,QQ经常干
这事),sh.SendKeys 就把命令输入到其他地方去了,请问高手有解决办法吗? 跪求啊