This is an old revision of the document!

How do I automate file transfers?

WinSCP has supports scripting that you can use to automate many operation that it supports, including file transfers.

Commands

To automate operation, you need to find out commands necessary to implement it. For simple operations you need at least to:

Script file

Assemble the commands into script file. You can name the script file as you like. See simple example and some useful scripts.

Use /script command line option to pass the script to WinSCP. You can embed whole command line into Windows batch file (.bat), such as:

@echo off
winscp /console /script=myscript.txt

Using script

Now to make using script easier/automatic you can:

  • Make shortcut to it on desktop. Either make shortcut to batch file (.bat) or enter full command line to shortcut itself.
  • Schedule automatic execution.

Notes

When connecting to particular host for the first time, you will be prompted to verify host key.