Topic "Simple VBScript syntax error?"

Author Message
edflecko

Guest


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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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:
http://winscp.net/eng/docs/library_com_wsh
http://winscp.net/eng/docs/library_powershell
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License