Differences

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

2015-01-10 2015-01-10
<scp.c.mpz (117.98.3.30) (hidden) Restored revision 1418992755. Undoing revisions 1420897739, 1420898266. (Petr) (hidden)
Line 10: Line 10:
&screenshotpict(scripting) &screenshotpict(scripting)
-====== 111 b====== Level 1 Headline ====== 
- 
- ====== 
===== Using Scripting ===== ===== Using Scripting =====
Enter the console/scripting mode by using ''[[executables|winscp.com]]''; or ''/console'' command-line parameter with ''[[executables|winscp.exe]]''. For details see [[commandline#scripting|console/scripting command-line parameters]]. Enter the console/scripting mode by using ''[[executables|winscp.com]]''; or ''/console'' command-line parameter with ''[[executables|winscp.exe]]''. For details see [[commandline#scripting|console/scripting command-line parameters]].
-For automation, commands can be read from a script file specified by ''/scr''<.1cfg./scp +For automation, commands can be read from a script file specified by ''/script'' switch, passed from the command-line using the ''/command'' switch, or read from standard input of ''winscp.com''.
-''ipt'' switch, passed from the command-line using the ''/command'' switch, or read from standard input of ''winscp.com''.+
By default an interactive mode is used (the user is prompted in the same way as in GUI mode). To switch to batch mode (all prompts are automatically answered negatively) use the command ''[[scriptcommand_option|option batch abort]]''. For batch mode it is recommended to turn off confirmations using ''[[scriptcommand_option|option confirm off]]'' to allow overwrites (otherwise the [[ui_overwrite|overwrite confirmation prompt]] would be answered negatively, making overwrites impossible). //Since 5.6 beta, when running commands specified using ''/script'' or ''/command'', batch mode is used implicitly and overwrite confirmations are turned off.// &beta (* Other articles referring to "option batch abort" are left intact until 5.6.x stable *) By default an interactive mode is used (the user is prompted in the same way as in GUI mode). To switch to batch mode (all prompts are automatically answered negatively) use the command ''[[scriptcommand_option|option batch abort]]''. For batch mode it is recommended to turn off confirmations using ''[[scriptcommand_option|option confirm off]]'' to allow overwrites (otherwise the [[ui_overwrite|overwrite confirmation prompt]] would be answered negatively, making overwrites impossible). //Since 5.6 beta, when running commands specified using ''/script'' or ''/command'', batch mode is used implicitly and overwrite confirmations are turned off.// &beta (* Other articles referring to "option batch abort" are left intact until 5.6.x stable *)
Line 135: Line 131:
FTPS/WebDAVS [[tls#certificate|TLS/SSL certificate]] signed by untrusted authority may also need to be verified. To automate the verification in script, use ''-certificate'' switch of ''[[scriptcommand_open|open]]'' command to accept the expected certificate automatically. FTPS/WebDAVS [[tls#certificate|TLS/SSL certificate]] signed by untrusted authority may also need to be verified. To automate the verification in script, use ''-certificate'' switch of ''[[scriptcommand_open|open]]'' command to accept the expected certificate automatically.
-**sums 
-**===== [[different_account]] Running a Script under a Different Account (e.g., Using a Scheduler) bios.nt 
 +===== [[different_account]] Running a Script under a Different Account (e.g., Using a Scheduler) =====
If you are going to run the script under a different account (for example using the Windows scheduler), don't forget that WinSCP still needs to access its configuration. Note that when using registry as [[config|configuration storage]], the settings are accessible only for your Windows account, so in such a case you may need to either transfer the configuration from your account registry to the other account's registry or use the [[config|INI file]] instead. If you are going to run the script under a different account (for example using the Windows scheduler), don't forget that WinSCP still needs to access its configuration. Note that when using registry as [[config|configuration storage]], the settings are accessible only for your Windows account, so in such a case you may need to either transfer the configuration from your account registry to the other account's registry or use the [[config|INI file]] instead.
Line 214: Line 209:
  * [[scripts|Useful example scripts]];   * [[scripts|Useful example scripts]];
  * [[library|WinSCP .NET assembly]].   * [[library|WinSCP .NET assembly]].
 +

Last modified: by Petr