Topic "SFTP script error: Opening session using command-line parameter in scripting is deprecated"

Author Message
mfrank

Guest


I am trying to do a simple file transfer to an SFTP site using a .bat file to call WinSCP.com, passing it a basic script file. This is how all the examples I can find on the internet seem to show how to do things. If I manually type the open/put statements into the CMD window, everything works great, but when I try to run the .bat file, I get the error:
"Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead".

The .bat file simply contains:
Winscp.com /script = SFTPTest.txt

The SFTPTest.txt file contains:
# Connect to SFTP site
open sftp://login:password@hostsite
# Upload the file to current working directory
put Testfile.TXT
# Disconnect
close
# Exit WinSCP
exit

Any ideas how to get this working? My hope is to be able to schedule the .bat file to run daily to copy the file to the SFTP site.

Thanks
Advertisements
endeekay
[View user's profile]

Joined: 2016-05-19
Posts: 2
Perhaps try this in your batch file:
Code:
WinSCP.exe /console /script=SFTPTest.txt


And place the bat file in your WinSCP folder where the WinSCP.exe file is located.
mfrank

Guest


Hot damn! It looks like fixed the problem.

It's interesting, because I was following the syntax in the WinSCP documentation, and it didn't show using the /console option.
http://winscp.net/eng/docs/scripting

Thank you very much
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
It has nothing to do with the /console parameter, as that's implicit with winscp.com you were using.

The problem was the spaces around the =.

This is the correct syntax: winscp.com /script=SFTPTest.txt
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