Help with VB script

Advertisement

Guest

Help with VB script

Hi,

I'm a total newbie at this and now my way around VB, I would like to have a script where I drop a folder, I extract the folder name and connect to a NAS where I want it to move this specific folder from one place to another with MV.

I started to make a test, but I get an error on row exec.StdIn.Write(
Set objArgs = WScript.Arguments
'WScript.Echo WScript.Arguments.Count

myFolder = Split(objArgs(0),"\")
intIndex = Ubound(myFolder)
WScript.Echo myFolder(intIndex)

Set shell = WScript.CreateObject("WScript.Shell")
'run (make it log to XML)
shell.Exec("""C:\Program Files (x86)\WinSCP\WinSCP.exe""")
' feed the commands
exec.StdIn.Write("option batch abort\n" + "open Nas\n" +"ls /share/HDA_DATA/Test\n" +"exit\n")

'wait until it finishes and collect its output
StdOut.ReadAll()
'optionally print the output
WScript.Echo(output)

 

Suggestions how I can get this to work ?

Reply with quote

Advertisement

Guest

Thanks !

Set objArgs = WScript.Arguments
'WScript.Echo WScript.Arguments.Count

myFolder = Split(objArgs(0),"\")
intIndex = Ubound(myFolder)
WScript.Echo myFolder(intIndex)

Set shell = WScript.CreateObject("WScript.Shell")
'run (make it log to XML)
set exec = shell.Exec("""C:\Program Files\WinSCP\WinSCP.exe""")
' feed the commands
exec.StdIn.Write("option batch abort\n" + "open Nas\n" +"ls /share/HDA_DATA/'test\n" +"exit\n")

'wait until it finishes and collect its output
set output = exec.StdOut.ReadAll()
'optionally print the output
WScript.Echo(output)

Now it starts winscp, but it does not login and do the ls part. and logging in manually and quit Winscp gives me Objext required: '[string:""]' on set output row.

Suggestions ?

Reply with quote

Advertisement

You can post new topics in this forum