View Single Post
  #8  
Old 01-07-2019, 09:41 AM
amy_itx_aps amy_itx_aps is offline
Registered User
 
Join Date: Dec 2018
Posts: 8
vbs scripts

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

'turn on synchronous mode so we don't miss any data
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
Loop

'crt.Quit()

End Sub


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

'crt.Screen.Synchronous = False
crt.Screen.Synchronous = True

equipmentInfo = Split(line)

ip = equipmentInfo(0)
uname = equipmentInfo(1)
pwd = equipmentInfo(2)
path = equipmentInfo(3)


crt.session.ConnectInTab "/SSH2 /L "&uname&" /PASSWORD "&pwd&" "&ip


crt.Screen.WaitForString("$")

crt.Screen.Send " cd " &path & chr(13)

End Sub




ip_uu_pass.txt:

192.168.80.123 oracle oracle /home/oracle/data
192.168.80.124 app app /home/app
192.168.80.3 han han /home/han

At the end of the code


crt.Screen.WaitForString("$")

crt.Screen.Send " cd " &path & chr(13)


Added two lines at the end of the code
crt.Screen.WaitForString("$")
crt.Screen.Send " cd " &path & chr(13)

The two lines failed to achieve the expected purpose, the first unix host executed cd /home/oracle/data cd /home/app cd /home/han Obviously this is not my expected effect, it should be one by one Corresponding to cd to the target directory
Attached Images
File Type: png sshot-2.png (159.9 KB, 123 views)
Reply With Quote