This is an old revision of the document!

How do I configure session and/or transfer settings for which there are no script commands?

For session settings, you can pre-configure a stored session with all your settings from GUI and open that stored session using open command. For transfer setting, you can pre-configure your preferred settings as default transfer settings. The script uses the default transfer settings as initial.

If you want to make your configuration portable, you can store it into an INI file and distribute the INI file with your script.

Advertisement

For example to enable HTTP proxy use following INI file:

[Sessions\mysession]
HostName=example.com
UserName=customer
ProxyMethod=3
ProxyHost=proxy
ProxyPort=8080

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:

echo [Sessions\mysession] > server.ini
...
echo ProxyHost=%PROXYHOST% >> server.ini
...
winscp /console /script=example.txt /ini=server.ini
del server.ini

For example, to configure changing case of filenames to lowercase during transfer, use following INI file:

[Configuration\Interface\CopyParam]
FileNameCase=2

Advertisement

Last modified: by martin