Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Simple VBScript syntax error?

It's really an unnecessary mess with all those " and &.
Anyway, you are definitely missing a space between the "open transfer ascii" and "open..." commands as well as between "open..." and "get...".

Also consider using WinSCP .NET assembly. Either via COM from VBScript or, if you do not need VBscript, using PowerShell instead:
https://winscp.net/eng/docs/library_com_wsh
https://winscp.net/eng/docs/library_powershell
edflecko

Simple VBScript syntax error?

I have a really simple vbscript to run WinSCP that doesn't error...but it clearly doesn't run either.

Option Explicit
Dim objFSO
Dim objShell

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run """C:\Program Files\WinSCP\winscp.exe /console /command """ & """option batch abort""" & " " & """option confirm on""" & " " & """option transfer ascii""" & """open sftp://username:password@mycompany.com""" & """get textfile.txt C:\file\path\textfile.txt""" & " " & """close""" & " " & """exit"""

Wscript.Quit

What am I doing wrong?

Ed