Differences

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

2016-01-01 2016-01-22
exit command (martin) parameter anchors (martin)
Line 35: Line 35:
Assemble the commands into a script file. You can name the script file as you like. See [[scripting#example|simple example]] and some [[scripts|useful scripts]]. Assemble the commands into a script file. You can name the script file as you like. See [[scripting#example|simple example]] and some [[scripts|useful scripts]].
-Use the ''/script'' [[commandline|command line]] option to pass the script to the WinSCP [[executables|executable]]. You can embed the complete command line into a Windows batch file (''.bat''), like as follows:+Use the ''/script'' [[commandline#scripting|command line]] option to pass the script to the WinSCP [[executables|executable]]. You can embed the complete command line into a Windows batch file (''.bat''), like as follows:
<code batch> <code batch>
@echo off @echo off
Line 47: Line 47:
===== [[using]] Using script ===== ===== [[using]] Using script =====
Now to make using script easier/automatic you can: Now to make using script easier/automatic you can:
-  * Make shortcut to it on desktop to ease execution. Either make shortcut to batch file (''.bat'') or enter full command line to shortcut itself.((Note that it is not possible to use ''winscp.com'' (''.com'' files in general) directly from a shortcut. Call ''winscp.com'' from a batch file or use ''winscp.exe'' with ''/console'' command-line parameter.))+  * Make shortcut to it on desktop to ease execution. Either make shortcut to batch file (''.bat'') or enter full command line to shortcut itself.((Note that it is not possible to use ''winscp.com'' (''.com'' files in general) directly from a shortcut. Call ''winscp.com'' from a batch file or use ''winscp.exe'' with ''[[commandline#scripting|/console]]'' command-line parameter.))
  * If the wrapping batch file takes filename as command line parameter (see [[#modifying_the_script_automatically|below]]) you can:   * If the wrapping batch file takes filename as command line parameter (see [[#modifying_the_script_automatically|below]]) you can:
    * Make shortcut to it on desktop and use it by dropping files on the icon. Windows automatically run the batch file and passes path to dropped file as command-line parameter.     * Make shortcut to it on desktop and use it by dropping files on the icon. Windows automatically run the batch file and passes path to dropped file as command-line parameter.
Line 111: Line 111:
To check results of the script you can: To check results of the script you can:
  * Check exit code of WinSCP (exit code is the only relevant and reliable way to check if script completed successfully). See example below and [[faq_script_result|FAQ]].   * Check exit code of WinSCP (exit code is the only relevant and reliable way to check if script completed successfully). See example below and [[faq_script_result|FAQ]].
-  * Save and inspect log file. [[logging_xml|XML log format]] is recommended. Use [[commandline|command-line]] parameter ''/xmllog''.+  * Save and inspect log file. [[logging_xml|XML log format]] is recommended. Use command-line parameter ''[[commandline#logging|/xmllog]]''.
  * Save and inspect output of the script. Use [[executables|output redirection]].   * Save and inspect output of the script. Use [[executables|output redirection]].

Last modified: by martin