#$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
转载于:https://blog.51cto.com/zhouzhenxing/1739306