我運行下面的VBScript文件自動執行telnet和ftp在窗戶的VBScript:如何有效使用的WScript的SendKeys
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run("telnet.exe 10.10.10.10")
WScript.Sleep 500
WshShell.SendKeys"root"
WshShell.SendKeys("{Enter}")
WScript.Sleep 500
WshShell.SendKeys"root123"
WshShell.SendKeys("{Enter}")
WScript.Sleep 500
WshShell.SendKeys"cd /code && make"
WshShell.SendKeys("{Enter}")
WScript.Sleep 5000
WshShell.SendKeys"ls -lrt"
WshShell.SendKeys("{Enter}")
但我覺得,在執行,這就會彈出命令提示符。它將繼續以500毫秒的間隔向命令提示符窗口發送密鑰。如果我點擊另一個窗口,則執行此操作時,此腳本將開始向其他窗口而不是命令提示符發送密鑰。
是否有任何其他方式來執行telnet自動化沒有SendKeys功能?