Differences
This shows you the differences between the selected revisions of the page.
2012-08-16 | 2012-09-24 | ||
disabled is 2 (martin) | 5.1 is stable (martin) | ||
Line 1: | Line 1: | ||
====== How do I configure session, transfer and/or any other settings for which there are no script commands? ====== | ====== How do I configure session, transfer and/or any other settings for which there are no script commands? ====== | ||
- | Generally the solution is to configure the settings in GUI. Script will in the most cases use the preconfigured settings as default one. //For session settings, in the latest beta release, preferred solution is to use ''-rawsettings'' switch//. &beta | ||
- | |||
- | If you want to make your configuration portable, you can [[config|save it into an INI file]] and distribute the INI file with your script. | ||
- | |||
- | If the value of the option is not static you can generate the INI file before running the script. See examples below. | ||
- | |||
- | You may want to set the INI file read-only, to prevent WinSCP writing to it, when exiting. | ||
- | |||
===== Session Settings ===== | ===== Session Settings ===== | ||
- | For session settings, you can use ''-rawsettings'' switch or ''[[scriptcommand_open|open]]'' command (&beta_feature) or pre-configure a [[session_configuration#stored|stored session]] with all your settings [[ui_login|from GUI]] and open that stored session using the ''open'' command. | + | For session settings, you can use ''-rawsettings'' switch of ''[[scriptcommand_open|open]]'' command. |
- | + | ||
- | ==== Using -rawsettings Switch ==== | + | |
- | &beta_feature | + | |
For example to open session with enabled HTTP proxy use following command: | For example to open session with enabled HTTP proxy use following command: | ||
Line 19: | Line 8: | ||
</code> | </code> | ||
- | ==== Using Stored Session ==== | + | See [[rawsettings|raw session settings]] syntax. |
- | For example to enable HTTP proxy use following INI file: | + | |
- | <code ini> | + | |
- | [Sessions\mysession] | + | |
- | HostName=example.com | + | |
- | UserName=customer | + | |
- | ProxyMethod=3 | + | |
- | ProxyHost=proxy | + | |
- | ProxyPort=8080 | + | |
- | </code> | + | |
- | Then, providing the INI file is found and loaded by the WinSCP process running the script, you can use command "open mysession" to open the pre-configured session. | + | ===== Transfer Settings ===== |
+ | For [[transfer_settings|transfer setting]], you can pre-configure your preferred settings as [[ui_pref_transfer|default transfer settings]]. The script uses the default transfer settings as initial. | ||
- | You can even make a batch file that generates the INI file dynamically based on current context. For example to use value of environmental variable as proxy host name use following batch file: | + | If you want to make your configuration portable, you can [[config|save it into an INI file]] and distribute the INI file with your script. |
- | <code> | + | If the value of the option is not static you can generate the INI file before running the script. |
- | echo [Sessions\mysession] > server.ini | + | |
- | ... | + | |
- | echo ProxyHost=%PROXYHOST% >> server.ini | + | |
- | ... | + | |
- | winscp /console /script=example.txt /ini=server.ini | + | |
- | del server.ini | + | |
- | </code> | + | |
- | ==== Syntax and Examples ==== | + | You may want to set the INI file read-only, to prevent WinSCP writing to it, when exiting. |
- | See [[rawsettings|raw session settings]] syntax. | + | |
- | + | ||
- | ===== Transfer Settings ===== | + | |
- | For [[transfer_settings|transfer setting]], you can pre-configure your preferred settings as [[ui_pref_transfer|default transfer settings]]. The script uses the default transfer settings as initial. | + | |
==== Examples ==== | ==== Examples ==== |