Differences
This shows you the differences between the selected revisions of the page.
scriptcommand_option 2014-07-14 | scriptcommand_option 2020-05-29 (current) | ||
Line 1: | Line 1: | ||
- | ====== option ====== | + | ====== option command ====== |
Shows or sets value of script options. | Shows or sets value of script options. | ||
Line 8: | Line 8: | ||
===== Remarks ===== | ===== Remarks ===== | ||
- | If no parameters are specified, lists all script options and their values. When one parameter is specified only, shows value of the option. When two parameters are specified sets value of the option. Initial values of some options are taken from application configuration, however modifying the options does not change the application configuration. | + | If no parameters are specified, lists all script options and their values. When one parameter is specified only, shows value of the option. When two parameters are specified sets value of the option. |
+ | |||
+ | The default values shown below are defaults for the application. The initial values of some options can be different, if you [[scripting#configuration|share configuration with graphical mode]]. | ||
Options are: | Options are: | ||
^ Option ^ Values and description ^ | ^ Option ^ Values and description ^ | ||
- | | ''echo'' | ''%%off|on%%'' \\ Toggles echoing of command being executed. \\ Commands affected: all | | + | | ''==echo=='' | ''%%off|on%%'' \\ Toggles echoing of command being executed. \\ Commands affected: all \\ Default: ''off'' | |
- | | ''batch'' | ''%%off|on|abort|continue%%'' \\ Enables batch mode. In batch mode, any choice prompt is automatically replied and any input prompt is cancelled (after short time interval). \\ In batch mode, it is recommended to set ''confirm'' to ''off'' to allow overwrites. \\ When batch mode is set to ''on'' any choice prompt is automatically replied negatively. Unless the prompt has different default answer (such as default "Reconnect" answer for reconnect prompt), in what case the default answer is used (after short time interval). See also ''reconnecttime'' option below. \\ Value ''abort'' is like ''on''. In addition, the script is aborted, when any script command fails or any choice prompt is replied with "Abort" answer (or similar). \\ When set to ''continue'' any choice prompt is automatically replied with "Skip", "Ignore" or similar answer. \\ Enabling batch mode sets reconnect time (''reconnecttime'' option below) to 120 seconds, if it is not set yet (&beta_feature) \\ Commands affected: nearly all | | + | | ''==batch=='' | ''%%off|on|abort|continue%%'' \\ Enables batch mode. In batch mode, any choice prompt is automatically replied and any input prompt is cancelled (after short time interval). \\ In batch mode, it is recommended to set ''[[#confirm|confirm]]'' to ''off'' to allow overwrites. \\ When batch mode is set to ''on'' any choice prompt is automatically replied negatively. Unless the prompt has a different default answer (such as a default "Reconnect" answer for a reconnect prompt), in what case the default answer is used (after a short time interval). See also a ''[[#reconnecttime|reconnecttime]]'' option below. \\ Value ''abort'' is like ''on''. In addition, the script is aborted, when any script command fails or any choice prompt is replied with "Abort" answer (or similar). \\ When set to ''continue'' any choice prompt is automatically replied with "Skip", "Ignore" or similar answer. \\ Enabling batch mode sets reconnect time (''[[#reconnecttime|reconnecttime]]'' option below) to 120 seconds, if it is not set yet. \\ Commands affected: nearly all \\ Default: ''abort'' for commands specified using ''[[commandline#scripting|/script]]'' or ''[[commandline#scripting|/command]]''; ''off'' for commands specified on input. | |
- | | ''confirm'' | ''%%off|on%%'' \\ Toggles confirmations (overwrite, etc.). \\ Commands affected: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_put|put]]'' | | + | | ''==confirm=='' | ''%%off|on%%'' \\ Toggles confirmations (overwrite, etc.). \\ Commands affected: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_put|put]]'' \\ Default: ''off'' for commands specified using ''[[commandline#scripting|/script]]'' or ''[[commandline#scripting|/command]]''; ''on'' for commands specified on input. | |
- | | ''reconnecttime'' | ''%%off | <sec>%%'' \\ Sets time limit in seconds to try reconnecting broken sessions. Default value ''off'' removes any time limit. \\ Reconnect time is set implicitly to 120 seconds, when batch mode (''batch'' option above) is enabled (&beta_feature) \\ Commands affected: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]]'', ''[[scriptcommand_keepuptodate|keepuptodate]]'' | | + | | ''==reconnecttime=='' | ''%%off | <sec>%%'' \\ Sets time limit in seconds to try reconnecting broken sessions. Value ''off'' removes any time limit. \\ Reconnect time is set implicitly to 120 seconds, when batch mode (''[[#batch|batch]]'' option above) is enabled. \\ Commands affected: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_synchronize|synchronize]]'', ''[[scriptcommand_keepuptodate|keepuptodate]]'' \\ Default: ''off'' | |
- | | ''failonnomatch'' | ''%%off|on%%'' \\ Toggles whether commands fail when file mask matches no files. Default value is ''off''. &beta_feature \\ Commands affected: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_rm|rm]]'', ''[[scriptcommand_mv|mv]]'', ''[[scriptcommand_chmod|chmod]]'' | | + | | ''==failonnomatch=='' | ''%%off|on%%'' \\ Toggles whether commands fail when a [[file_mask|wildcard]] used to select files for an operation matches no files or when directory synchronization does not find any difference. \\ Commands affected: ''[[scriptcommand_get|get]]'', ''[[scriptcommand_put|put]]'', ''[[scriptcommand_rm|rm]]'', ''[[scriptcommand_mv|mv]]'', ''[[scriptcommand_chmod|chmod]]'', ''[[scriptcommand_ls|ls]]'', ''[[scriptcommand_lls|lls]]'', ''[[scriptcommand_ls|ls]]'', ''[[scriptcommand_synchronize|synchronize]]'' \\ Note that the option does not affect ''-filemask'' switch of ''get'' and ''put'' commands. \\ Default: ''off'' | |
Note that resetting the same option overwrites a previous value, it does not append. | Note that resetting the same option overwrites a previous value, it does not append. | ||
- | |||
- | Aliases: ''ascii'' (for ''option transfer ascii''), ''binary'' (for ''option transfer binary'') | ||
===== Examples ===== | ===== Examples ===== | ||
<code winscp> | <code winscp> | ||
- | option transfer | + | option batch |
</code> | </code> | ||
<code winscp> | <code winscp> | ||
Line 33: | Line 33: | ||
</code> | </code> | ||
- | ===== Converting to .NET Assembly ===== | + | ===== [[net]] Converting to .NET Assembly ===== |
When [[library_from_script|converting script to .NET Assembly]], map options as follows: | When [[library_from_script|converting script to .NET Assembly]], map options as follows: | ||
Line 39: | Line 39: | ||
| ''echo'' | Irrelevant for .NET assembly. | | | ''echo'' | Irrelevant for .NET assembly. | | ||
| ''batch'' | Read about [[library_from_script#mode|mapping scripting modes to .NET assembly]]. | | | ''batch'' | Read about [[library_from_script#mode|mapping scripting modes to .NET assembly]]. | | ||
- | | ''confirm'' | .NET asembly is non-interactive, so confirmations are always off. | | + | | ''confirm'' | .NET assembly is non-interactive, so confirmations are always off. | |
- | | ''reconnecttime'' | Set ''[[library_session|Session.ReconnectTime]]''. | | + | | ''reconnecttime'' | Set ''[[library_session#reconnecttime|Session.ReconnectTime]]''. | |
- | | ''failonnomatch'' | No explicit mapping. To check if mask matches any file, you have to retrieve directory listing and search the listing for matching files. | | + | | ''failonnomatch'' | No explicit mapping. To check if mask matches any file, you have to retrieve directory listing and search the listing for matching files. For file transfers and synchronization, use a method return value, to check if the method performed any operation. | |
- | For example the following most common script option prologue does not need any mapping to .NET assembly, providing you follow instructions for [[library_from_script#mode|mapping scripting modes to .NET assembly]] for individual batch operation commands. | ||
- | |||
- | <code winscp> | ||
- | option batch abort | ||
- | option confirm off | ||
- | </code> | ||