Differences

This shows you the differences between the selected revisions of the page.

faq_automation 2008-02-14 faq_automation (current)
Line 1: Line 1:
-====== 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 [[script_commands|commands]] necessary to implement it. For simple operations you need at least to: 
-  * Set script to be performed non-interactively. For most automation scripts, you should use commands ''[[script_commands#option|option batch on]]'' and ''[[script_commands#option|option confirm off]]''. 
-  * Open session. You can use ''[[script_commands#open|open]]'' command (alternativally specify session on [[commandline|command line]]). 
-  * Perform operation. For [[task_upload|uploads]] use ''[[script_commands#put|put]]'' command, [[task_download|downloads]] use ''[[script_commands#get|get]]'' command. For other operations, see [[script_commands|supported commands]]. 
-  * Exit scripting using ''[[script_commands#exit|exit]]'' command. 
- 
-===== Script file ===== 
-Assemble the commands into script file. You can name the script file as you like. See [[scripting#example|simple example]] and some useful [[scripts]]. 
- 
-Use ''/script'' [[commandline|command line]] option to pass the script to WinSCP. You can embed whole command line into Windows batch file (''.bat''), such as: 
-<code> 
-@echo off 
-winscp /console /script=myscript.txt 
-</code> 
- 
-===== 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. 
-  * [[faq_schedule|Schedule automatic execution]]. 
- 
-===== Notes ===== 
-When connecting to particular host for the first time, you will be prompted to [[ssh#verifying_the_host_key|verify host key]].