Sub Main Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fso,file1,line,str1,params Set fso = CreateObject("Scripting.FileSystemObject") Set file1 = fso.OpenTextFile("D:\SWbackup\list1.txt",Forreading, False) xsh.Screen.Synchronous = True DO While file1.AtEndOfStream <> True line = file1.ReadLine params = Split (line) xsh.Session.LogFilePath = "d:\SWbackup\log\" & params(0) & ".txt" xsh.Session.StartLog Dim host host = params(1) Dim user user = params(2) Dim password password = params(3) xsh.Session.Open "SSH://" & user & ":" & password & "@" & host xsh.Screen.Synchronous = True xsh.Screen.waitForString "#" xsh.Screen.Send vbcrlf & vbcr & vbcr & vbcr & vbcr xsh.Screen.Synchronous = True ' Dim screenrow ' screenrow = xsh.Screen.CurrentRow - 1 Dim str8 str8 = xsh.Screen.Get(xsh.Screen.CurrentRow - 1,1, xsh.Screen.CurrentRow,1) xsh.Screen.waitForString "#" xsh.Session.Sleep 100 str1 = "show config" xsh.Screen.Send str1 & vbcr Call xsh.Screen.waitForStrings ("--- Press CTRL+C to quit ---", 1000) xsh.Screen.Send " " & vbcr xsh.Screen.waitForString "#" xsh.Session.Sleep 100 xsh.Session.StopLog xsh.Session.Close loop xsh.Screen.Synchronous = False End Sub