#$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