WinSCP/VBScript Issue

Advertisement

John Garland
Joined:
Posts:
3
Location:
North East England

WinSCP/VBScript Issue

sing the code in the "Windows script host (JScript or VB script)" section of your "Advanced FTP/SFTP scripting" document, I created the following:



Option Explicit

Dim ObjShell, Exec, Output, ObjMessage

Set ObjShell = CreateObject("WScript.Shell")
Set Exec = ObjShell.Exec("c:\program files\winscp\winscp.com")

Exec.StdIn.Write( _
"option batch abort\n" +_
"option confirm off\n" +_
"open myuser:mypassword@downloads.company.com\n" +_
"get /remotepathname/remotefilename.zip c:\localpathname\localfilename.zip\n" +_
"exit\n")

Output = Exec.StdOut.ReadAll()

WScript.Echo(Output)



When I run it a blank console screen appears and the script seems to hang. On closing the screen Output is displayed and contains the WinSCP command prompt. I've tried several solutions from your help pages and Google (to do with ReadAll and StdOut/StdErr issues of which I know little)and have drawn a blank. Any pointers/suggestions/clues appreciated.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum