Getting "Host "=" does not exist" when trying to automate file transfers using WinSCP script

4

1

I am trying to automate some file transfers using WinSCP scripting. This is what I have.

option echo off
option batch on
option confirm off
open abcde:abcde@sftp.xxxyyyzzz.net

lcd "t:\"

put -nopermissions -nopreservetime "test.txt" test.txt

exit

I can actually get to the command line and run the open, lcd, and put commands without any issue. When I use the script, I receive this error:

Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Searching for host...
Host "=" does not exist.

I got through the connection hurdle by putting the connection command in the batch file pulling the script.

Winscp.com abcde:abcde@sftp.xxyyzz.net

How do I call the script to run the rest of the tasks?

Pratik

Posted 2015-12-11T15:56:06.483

Reputation: 41

Answers

3

You need to save your WinSCP script to a file (e.g. script.txt).

And then make WinSCP run the script using /script= command-line switch, like:

winscp.com /log=winscp.log /script=script.txt

You should start with a guide to automating SFTP file transfers using WinSCP.

Martin Prikryl

Posted 2015-12-11T15:56:06.483

Reputation: 13 764

/script= ... you saved me dude – Mickey Perlstein – 2017-08-23T10:35:30.327

0

This worked for me. I saved the following text as .bat file and ran it.

echo off
WinScp /ini=nul /command "open ubuntu@52.52.52.242 - 
privatekey=D:\PostgresXL.ppk" "move_files_or_do_something" "exit"

Manideep Karthik

Posted 2015-12-11T15:56:06.483

Reputation: 1