#1
|
|||
|
|||
simple ip textfile loop help
hi i just want to
connect telnet from line 1 of ip.txt then common commands disconnect then connect telnet from line 2 of ip.txt then common commands disconnect and so on and so on can some one help? this is my code Code:
#$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True Const ForReading = 1 Sub Main ' Open a file, read it in & send it one line at a time Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("d:\ip.txt", ForReading, 1) Dim line, params Do While f.AtEndOfStream <> True ' Read each line of the ip file. ' line = f.Readline crt.Session.Connect "/TELNET " & params(0) & " " & 23 crt.Screen.WaitForString "Password: " crt.Screen.Send "password" & chr(13) crt.Screen.WaitForString "router> " crt.Screen.Send "exit" & chr(13) Set objFSO = CreateObject("Scripting.FileSystemObject") Const ForWriting = 2 Const ForAppending = 8 ' Create a new file (or overwrite an existing one) Set objStream = objFSO.OpenTextFile( _ "D:\MyDataFile.txt", _ ForAppending, _ True) objStream.WriteLine crt.Session.RemoteAddress objStream.Close crt.Screen.Send "exit" & chr(13) loop End Sub Last edited by miked; 05-11-2013 at 10:30 AM. Reason: put code in code block |
Thread Tools | |
Display Modes | Rate This Thread |
|
|