I wanna know if there is a way to run WinSCP commands like open sftp...
, from a batch file, without having to enter commands after WinSCP opens up.
Here's what I wanna happen:
demo.bat
) that opens WinSCP command-line.open
, get
, put
, etc.) in demo.bat
.demo.bat
opens up WinSCP command-line and executes the commands (get
, put
, etc.) automatically. Use /command
or /script
command-line switches.
There's a guide to automating file transfers to SFTP server with WinSCP.
A simple batch file using /command
switch is like:
WinSCP.com ^
/log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
/command ^
"open sftp://username:password@example.com/" ^
"put C:\local\path\file.txt /remote/path/" ^
"exit"
And WinSCP GUI can actually even generate the batch file for you: