我正在运行批处理文件,启动到Extreme网络交换机的telnet会话,禁用多个端口,然后关闭窗口。有人可以告诉我如何调整我的代码,以便两个窗口完全隐藏在视图之外?现在我使用VBS脚本的最后3行到ALT + F4窗口。这有效10次,但有时无法关闭窗口。
谢谢!
批处理文件
?Batch File (named disable.bat ):
:: Open a Telnet window
start telnet.exe 10.3.100.26
:: Run the script
cscript disable_script.vbs
VB脚本
set OBJECT=WScript.CreateObject("WScript.Shell")
'Login to Switch
OBJECT.SendKeys "admin{ENTER}"
WScript.sleep 50
OBJECT.SendKeys "password{ENTER}"
WScript.sleep 50
'Logout
OBJECT.SendKeys " enable ports 1-5{ENTER}"
WScript.sleep 25
OBJECT.SendKeys "quit{enter}"
WScript.sleep 50
OBJECT.SendKeys "n{enter}"
WScript.sleep 50
'Close Telnet Window
OBJECT.AppActivate "Telnet"
WScript.sleep 200
OBJECT.SendKeys "%{F4}"