Differences

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

2011-09-18 2011-09-29
no summary (Petr) batch abort (martin)
Line 11: Line 11:
For automation, commands can be read from a script file specified by ''/script'' switch, from standard input or passed from the command-line using the ''/command'' switch. For automation, commands can be read from a script file specified by ''/script'' switch, from standard input or passed from the command-line using the ''/command'' switch.
-By default an interactive mode is used (the user is prompted in the same way as in GUI mode). To switch to a batch mode (all prompts are automatically answered negatively) use the command ''[[scriptcommand_option|option batch on]]''. For the batch mode it is recommended to turn off confirmations using ''[[scriptcommand_option|option confirm off]]'' to allow overwrites (otherwise the overwrite confirmation prompt would be answered negatively, making overwrites impossible). +By default an interactive mode is used (the user is prompted in the same way as in GUI mode). To switch to a batch mode (all prompts are automatically answered negatively) use the command ''[[scriptcommand_option|option batch abort]]''. For the batch mode it is recommended to turn off confirmations using ''[[scriptcommand_option|option confirm off]]'' to allow overwrites (otherwise the overwrite confirmation prompt would be answered negatively, making overwrites impossible).
Multiple sessions can be opened simultaneously. Use the ''[[scriptcommand_session|session]]'' command to switch between them. Multiple sessions can be opened simultaneously. Use the ''[[scriptcommand_session|session]]'' command to switch between them.
Line 96: Line 96:
The example below connects to ''example.com'' server with account ''user'', downloads file and closes the session. Then it connects to the same server with the account ''user2'' and uploads the file back. The example below connects to ''example.com'' server with account ''user'', downloads file and closes the session. Then it connects to the same server with the account ''user2'' and uploads the file back.
<code winscp> <code winscp>
-# Automatically answer all prompts negatively not to stall +# Automatically abort script on errors 
-# the script on errors +option batch abort
-option batch on+
# Disable overwrite confirmations that conflict with the previous # Disable overwrite confirmations that conflict with the previous
option confirm off option confirm off
Line 131: Line 130:
For simple scripts you can specify all the commands on [[commandline|command-line]] using ''/command'' switch: For simple scripts you can specify all the commands on [[commandline|command-line]] using ''/command'' switch:
<code> <code>
-winscp.exe /console /command "option batch on" "open user@example.com" "get examplefile.txt d:\" "exit"+winscp.exe /console /command "option batch abort" "open user@example.com" "get examplefile.txt d:\" "exit"
</code> </code>

Last modified: by martin