SecureCRT根據文件中IP執行命令VBS

#$Language="VBScript"

#$Interface="1.0"

crt.Screen.Synchronous=True


rem 這是選擇文件

Function ChooseFile()

     Dim Result

     Result = ""

     Dim IE : Set IE = CreateObject("InternetExplorer.Application")

     With IE

         .Visible = False

         .Navigate("about:blank")

         Do Until .ReadyState = 4 : Loop

         With .Document

             .Write "<html><body><input id='f' type='file'></body></html>"

             With .All.f

                 .Focus

                 .Click

                 Result = .Value

             End With

         End With

         .Quit

     End With

Set IE = Nothing

    ChooseFile = Result

End Function




Sub Main()

Const ForReading = 1

Dim fso,f

set fso = CreateObject("Scripting.FileSystemObject")


rem 將文件對像賦值給變量f

set f = fso.OpenTextFile(ChooseFile,ForReading,0)

Dim LineStr

Do While f.AtEndOfStream <> True


rem 將每行賦值給變量LineStr

LineStr = f.Readline


rem 這是操作內容


crt.Screen.Send "ssh 用戶名@"&LineStr&chr(13)

crt.Sleep 2000

crt.Screen.Send "命令" & chr(13)

crt.Sleep 2000

crt.Screen.Send "exit" & chr(13)

crt.Sleep 2000

Loop


End Sub


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章