我這個問題是,我登錄多臺設備,但在日志檔案里總是顯示的是最后一臺設備的查看資訊,之前的設備資訊沒有應是被覆寫掉了,在CRT里選了追加到日志檔案里也不行的(默認是覆寫日志檔案)。不知是遠訓事。有那位大俠知道啊 ,腳本如下:
# $language = "VBScript"
# $interface = "1.0"
Sub Main
IpArray=ReadToArray("IP.txt")
For i=0 To Ubound(IpArray)-1
Concmd="/telnet"+" "+IpArray(i)
crt.session.Connect(Concmd)
crt.sleep 900
crt.Screen.Send "root" & vbCR
crt.sleep 900
crt.Screen.Send "admin" & vbCR
crt.sleep 1000
crt.Screen.Send "enable" & vbCR
crt.sleep 900
crt.Screen.Send "config" & vbCR
crt.sleep 900
crt.session.LogFileName = "c:\a.txt"
crt.session.Log true
crt.sleep 900
crt.Screen.Send " display mac-address all" & vbCR
crt.Screen.Send " " & vbCR
Do while (crt.Screen.WaitForString("--- More",2)<>False)
crt.Screen.Send " "
Loop
crt.session.Log false
crt.session.disconnect
Next
End Sub
Function ReadToArray(filespec)
Const ForReading = 1
Dim fso, theFile,i,RetString
Dim retArray()
Set fso = CreateObject("Scripting.FileSystemObject")
IF fso.FileExists(filespec) THEN
Set theFile = fso.OpenTextFile(filespec, ForReading,false,false)
i = 0
Do While theFile.AtEndOfStream <> True
RetString = Trim(theFile.ReadLine)
IF IsNull(RetString) <> True THEN
ReDim Preserve retArray(i+1)
retArray(i) = RetString
i=i+1
END IF
Loop
theFile.Close
ReadToArray = retArray
ELSE
ReadToArray= Null
MsgBox "組態檔無IP地址"+filespec
crt.session.Log false
END IF
End Function
uj5u.com熱心網友回復:
沒人啊。。。汗。。uj5u.com熱心網友回復:
我也出現類似情況 不知道和crt版本一樣不轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/136395.html
標籤:網絡編程
