Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Using saved connections / transfer Profiles

We do not recommend sharing GUI and scripting configuration.
https://winscp.net/eng/docs/scripting#configuration
Anyway, it's the (recommended) /ini=nul switch that isolates your script from the GUI configuration. If you do not want that, remove the switch.
Learza

Using saved connections / transfer Profiles

Hi,

I am new to WinSCP (and new to administration). Therefore, I lack good skills in batch scripting. Also, we won't be using WinSCP a lot, so my time spent on this topic should be limited.

I got it running, but only if I spell out the password in the batch file. I hoped to define the connection and the transfer profiles in the GUI and call this saved information within the batch file. That way, I could keep track and update later in the GUI and won't have to bother about updating all scripts. Also, I know for sure where the passwords are saved.

However, this is the current working file (file/connection/Mask Data replaced):
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /ini=nul /log="C:logFolder\batch.log" /command ^
    "open sftp://Username:Password@remoteServer/ -hostkey=""ssh-rsa KEY""" ^
    "synchronize local -filemask=""MyMask"" ""destinationFolder"" ""sourceFolder""" ^
    "exit"
pause

I would like to define TestConnection and Testprofile in the GUI and have the Batch File as
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /ini=nul /log="C:logFolder\batch.log" /command ^
    "open TestConnection ^
    "synchronize local -filemask=Testprofile ""destinationFolder"" ""sourceFolder""" ^
    "exit"
pause

Note: the first script is working. The set-up connection and profile are working also. So it seems to be my understanding in how to handle the batch file which keeps me from success.

The second script (and variants I tried) fail at loading the connection (seem to be taking TestConnection as the URL and tries to connect, so fails for sure).

Best regards,
Learza