Differences
This shows you the differences between the selected revisions of the page.
faq_script_ini 2012-04-23 | faq_script_ini 2023-05-19 (current) | ||
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 site, 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. | + | ===== Site Settings ===== |
+ | For site settings, you can use ''[[scriptcommand_open#rawsettings|-rawsettings]]'' switch of ''[[scriptcommand_open|open]]'' command. | ||
- | If the value of the option is not static you can generate the INI file before running the script. See examples below. | + | See [[rawsettings|raw site settings]] syntax. WinSCP can [[ui_generateurl|generate the code for you]]. |
- | You may want to set the INI file read-only, to prevent WinSCP writing to it, when exiting. | + | ===== [[transfer]] Transfer Settings ===== |
+ | For transfer settings, use ''-rawtransfersettings'' switch of script commands that transfer files, like [[scriptcommand_put#rawtransfersettings|''put'']], [[scriptcommand_get#rawtransfersettings|''get'']], [[scriptcommand_synchronize#rawtransfersettings|''synchronize'']], etc. | ||
- | ===== Session Settings ===== | + | See [[rawtransfersettings|raw transfer settings]] syntax. |
- | For session settings, you can use ''-rawsettings'' switch (&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 ''[[scriptcommand_open|open]]'' command. | + | |
- | ==== Using -rawsettings Switch ==== | + | ===== [[global]] Global Settings ===== |
- | &beta_feature | + | |
- | For example to open session with enabled HTTP proxy use following command: | + | For global settings, use ''[[commandline#rawconfig|/rawconfig]]'' command-line parameter. |
- | <code winscp> | + | |
- | open <session_url> -rawsettings ProxyMethod=3 ProxyHost=proxy ProxyPort=8080 | + | |
- | </code> | + | |
- | To find connect syntax for particular settings, configure the setting in the GUI, store it into a stored session, [[config|save configuration to an INI file]] and use the same syntax as in an INI file. See the next section for example. | + | See [[rawconfig|raw configuration]] syntax. |
- | + | ||
- | ==== Using Stored Session ==== | + | |
- | 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. | + | |
- | + | ||
- | 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: | + | |
- | + | ||
- | <code> | + | |
- | echo [Sessions\mysession] > server.ini | + | |
- | ... | + | |
- | echo ProxyHost=%PROXYHOST% >> server.ini | + | |
- | ... | + | |
- | winscp /console /script=example.txt /ini=server.ini | + | |
- | del server.ini | + | |
- | </code> | + | |
- | + | ||
- | ===== 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. | + | |
- | + | ||
- | For example, to configure changing case of filenames to lowercase during transfer, use following INI file: | + | |
- | + | ||
- | <code ini> | + | |
- | [Configuration\Interface\CopyParam] | + | |
- | FileNameCase=2 | + | |
- | </code> | + | |
- | + | ||
- | ===== Other Settings ===== | + | |
- | The same applies to most other settings, such as configuring reconnect interval: | + | |
- | <code ini> | + | |
- | [Configuration\Interface] | + | |
- | SessionReopenAuto=10000 | + | |
- | </code> | + | |