4

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:password@ftp.example.com: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 ?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
wraith
  • 351
  • 3
  • 18

2 Answers2

8

It's

winscp.com /command "open ftp://username:password@ftp.example.com/ -explicit" ...

or simply

winscp.com /command "open ftpes://username:password@ftp.example.com/" 

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;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
0

Try the following line:

winscp.com /command "option batch abort" "option confirm off" "open ftp://username:password@ftp.example.com:21 -   
explicittls" "put -filemask=>1D  D:\Backups\*.bak /" "exit"
Sallar Rabiei
  • 630
  • 1
  • 12
  • 33