set WshShell = WScript.CreateObject("WScript.Shell")
deviceip = inputbox("输入目标IP",,"192.168.1.1")
' Open Telnet and connect to device
if cping(deviceip)=0 then
intReturn = WshShell.Popup("IP Address " & deviceip & " is unreachable!", _
3, "Notice", wshYesNoDialog + wshExclamationMark)
wscript.quit
Else
intReturn = WshShell.Popup("IP Address " & deviceip & " could be connected normally!", _
3, "Notice", wshYesNoDialog + wshExclamationMark)
end if
WshShell.run("telnet.exe " & deviceip)
' Wait 1000 ms
WScript.Sleep 1000
' "Press" Enter
WshShell.SendKeys("{Enter}")
' Wait 5000 ms
WScript.Sleep 500
' "Type" user name
WshShell.SendKeys"username"
' "Press" Enter
WshShell.SendKeys("{Enter}")
' Wait 5000 ms
WScript.Sleep 500
' "Type" Password
WshShell.SendKeys"password"
' "Press" Enter
WshShell.SendKeys("{Enter}")
' Wait 5000 ms
WScript.Sleep 500