z6482098 2015-06-05 16:49 采纳率: 100%
浏览 3751
已采纳

新手求助,关于SecureCRT 中脚本运行总是提醒语句未结束的问题。

本人为了研究自动upgrade,写了一个脚本。在win7系统自带CMD中运行,无任何问题。编写成脚本后,crt.Screen.Send "/s/misc/eqid set "MTQ"" & vbcr这一行总是出故障。求大神指点,非常感激。

附脚本文件:

$language = "VBScript"

$interface = "1.0"

Sub Main
crt.Screen.Synchronous = True
Dim a,b,c
Dim row,d,row1,e

crt.Screen.Send "root" & vbcr
crt.Screen.WaitForString "Password:"
crt.Screen.Send "root" & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send "enable" & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send "/s/misc/stopreboot" & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send "/s/misc/eqid set "MTQ"" & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send "/s/misc/act_img get" & vbcr
crt.Screen.WaitForString "ONT>"
row = crt.screen.CurrentRow-1
d = crt.screen.Get(row, 10, row, 11)
crt.Screen.Send "/s/misc/commit_img get" & vbcr
crt.Screen.WaitForString "ONT>"

crt.Screen.Send "/s/fs/upgrade ontversion 192.168.1.253 ont ont" & vbcr
crt.Screen.WaitForString "ONT>"
Do
crt.Screen.Send "/s/misc/act_img get" & vbcr
crt.Screen.WaitForString "ONT>"
row1 = crt.screen.CurrentRow-1
e = crt.screen.Get(row1, 10, row1, 11)

If (d=e<>False) Then
c=1
crt.sleep(3000)
Else
c=2
End If

crt.Screen.Send d & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send e & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send c & vbcr
crt.Screen.WaitForString "ONT>"
Loop Until c=2

crt.Screen.Send "/s/misc/commit_img get" & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send "/s/misc/clearcfg" & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send "/s/misc/eqsn get" & vbcr
crt.Screen.WaitForString "ONT>"
crt.Screen.Send "/s/s" & vbcr
crt.Screen.WaitForString "/system/shell>"
crt.Screen.Send "reboot" & vbcr

End Sub

  • 写回答

1条回答 默认 最新

  • danielinbiti 2015-06-05 16:57
    关注
     crt.Screen.Send "/s/misc/eqid set "MTQ"" & vbcr
     改成
     crt.Screen.Send "/s/misc/eqid set ""MTQ""" & vbcr
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB代码补全插值
  • ¥15 Typegoose 中如何使用 arrayFilters 筛选并更新深度嵌套的子文档数组信息
  • ¥15 前后端分离的学习疑问?
  • ¥15 stata实证代码答疑
  • ¥50 husky+jaco2实现在gazebo与rviz中联合仿真
  • ¥15 dpabi预处理报错:Error using y_ExtractROISignal (line 251)
  • ¥15 在虚拟机中配置flume,无法将slave1节点的文件采集到master节点中
  • ¥15 husky+kinova jaco2 仿真
  • ¥15 zigbee终端设备入网失败
  • ¥15 金融监管系统怎么对7+4机构进行监管的