程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> set-新手求助,關於SecureCRT 中腳本運行總是提醒語句未結束的問題。

set-新手求助,關於SecureCRT 中腳本運行總是提醒語句未結束的問題。

編輯:編程綜合問答
新手求助,關於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

最佳回答:


 crt.Screen.Send "/s/misc/eqid set "MTQ"" & vbcr
 改成
 crt.Screen.Send "/s/misc/eqid set ""MTQ""" & vbcr
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved