SecureCRT 本身提供一种录制脚本的功能,可以通过录制脚本得到一个示例, 然后在此基础进行更改, 得到自己想要的脚本。
示例 #
#$language = "VBScript"
#$interface = "1.0"
crt.Screen.Synchronous = True
' This automatically generated script may need to be
' edited in order to work correctly.
Sub Main
While 1 <<<<< 循环
crt.Screen.Send "telnet 10.1.1.1" & chr(13)
crt.Screen.WaitForString "Username: "
crt.Screen.Send "cisco" & chr(10) & "cisco" & chr(10) & "show tcp trace " & chr(124) & " in vrfid " & chr(124) & " ex 0x60000000" & chr(13) & "exit" & chr(13)
crt.Screen.WaitForString "[ciscotac@CNP " & chr(126) & "]$ "
crt.Screen.Send chr(13)
crt.Sleep 5000 <<<<< sleep 5s
WEnd
End Sub
Others #
就目前来说, 循环+send chr + wait chr 已经满足我的一些测试,后续再遇到其他的发现再添加。
#### for 循环
For i = 1 To 10
Next