View Single Post
Old 12-31-2018, 09:01 PM
amy_itx_aps amy_itx_aps is offline
Registered User
Join Date: Dec 2018
Posts: 8
vbs scripts

Yes, I have had some trouble. I want my script to switch to the corresponding directory after reading the Unix in the text one by one. My script can only log in. I can't execute some commands after logging in.

file: ip_uu_pass.txt oracle oracle /home/oracle/data app app /home/app han han /home/han

vbs scripts

#$language = "VBScript"
#$interface = "1.0"

'turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
'crt.Screen.Synchronous = True

Sub Main
Set fso = CreateObject("Scripting.FileSystemObject")

Set file = fso.OpenTextFile("ip_uu_pass.txt")
crt.Window.Show 3

Do Until file.AtEndOfStream
line = file.ReadLine
commendAndLog line


End Sub

Sub commendAndLog(line)
' turn off synchronous mode to restore normal input processing

crt.Screen.Synchronous = False

equipmentInfo = Split(line)
ip = equipmentInfo(0)
uname = equipmentInfo(1)
pwd = equipmentInfo(2)

Call crt.Session.Log(False)

crt.Screen.Synchronous = True
crt.session.ConnectInTab "/SSH2 /L "&uname&" /PASSWORD "&pwd&" "&ip

crt.Screen.Send "export TMOUT=86400" & chr(13)
crt.Screen.WaitForString "export TMOUT=86400"

End Sub
Reply With Quote