Pablo prez
Pablo prez

Reputation: 199

Executing WinSCP command in batch file

I am new to batch and trying to execute a script I wrote, essentially I want to go to a remote server copy the files there and transfer it to a folder in my local directory. I am executing the bactch file but nothing is being copied any suggestions would be great. This is my script

open sftp://site:@ftp.site.net -hostkey="server finger print"
synchronize local C:\Users\localdirectory\Desktop\test2    /Home/folderA/NewFiles
exit

I am positive all the information is correct because that's how I login with WinSCP. I got this script from https://www.youtube.com/watch?v=ndvEYOQLc4c

Upvotes: 2

Views: 10101

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202168

This is WinSCP script. There's no batch file in your question.

To run WinSCP script, use for example:

"C:\Program Files (x86)\WinSCP\WinSCP.com" /script="C:\path\to\winscp.txt"

(assuming your WinSCP script is in C:\path\to\winscp.txt).

You can put the above command to a batch file.

See guide to scripting with WinSCP.

You can also have WinSCP GUI generate both the script and batch file for you (or even a batch file that directly contains the WinSCP commands).

Upvotes: 2

Related Questions