Search code examples
ftpwinscpftps

Setting WinSCP with explicit TLS encryption


I am trying to connect to a FTP server with following setting

winscp UI setting

This setting works well and I can connect to FTP server via GUI (version 5.7.5)

However, when I try to convert these settings to script

winscp.com /command "option batch abort" "option confirm off" "open ftp://username:[email protected]:21 -   
explicittls /" "put -filemask=>1D  D:\Backups\*.bak /" "exit"

and run it from cmd, there is an error message indicated that there is

Too many parameters for command 'open'."

What did I do wrong here and how to resolve it ?


Solution

  • It's

    winscp.com /command "open ftp://username:[email protected]/ -explicit" ...
    

    or simply

    winscp.com /command "open ftpes://username:[email protected]/" 
    

    See:

    You get the "Too many parameters for command 'open'" because of the / after the explicittls. Or because of the explicittls itself, if you really have the spaces there in-between the - and the explicittls.


    You can use Generate Transfer Code Dialog to have WinSCP generate the script or batch file for you.

    Generate transfer code


    Side notes:

    • option batch abort and option confirm off are not necessary since 5.7 anymore (they are implicit with /command);
    • you do not need to specify port 21, it's the default port for FTP;