我的目标是检查开关是否提示“>”或“#”,如果提示“>”发送启用密码,然后发送命令。如果切换提示符为“#”,则只发送命令。但是由于某种原因直接进入命令而不检查条件。
` result = crt.Screen.WaitForString ([">","#"])
If (result=1) Then
crt.Screen.Send chr(13)
crt.Screen.Send "XXXXX" & chr(13)
crt.Screen.WaitForString "Password: "
crt.Screen.Send "a" & chr(13)
crt.Screen.WaitForString "#"
End If
'++++++++++Now Send the command ++++++++++
crt.Screen.Send "sh ver" & chr(13)
crt.Screen.WaitForString vbcr
strReadScreen = crt.Screen.ReadString("#")`