Too many parameters for command 'open'

Advertisement

d.gerrardboards
Joined:
Posts:
2
Location:
UK

Too many parameters for command 'open'

Good Afternoon,

Can anyone offer advice on the below? Spent days and can't figure it out.

Everything seemed to work before I specified the hostkey, now I can successfully run the connection part of the script, but not rm onwards.
winscp.com /command "open sftp://bla@bla.com/ -hostkey="C:\bla\sqlbackup\HOST.ppk" -privatekey="C:\bla\sqlbackup\SFTP.ppk" "rm TEST.TXT" "put C:\bla\sqlbackup\TEST.TXT" exit

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,291
Location:
Prague, Czechia

Re: Too many parameters for command 'open'

If you need to use double quotes around switch value, you have to double them. See
https://winscp.net/eng/docs/commandline#syntax

Also, the value of -hostkey is a fingerprint not a path to a file.
https://winscp.net/eng/docs/scriptcommand_open#hostkey
winscp.com /command "open sftp://bla@bla.com/ -hostkey=""ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx..."" -privatekey=""C:\bla\sqlbackup\SFTP.ppk""" "rm TEST.TXT" "put C:\bla\sqlbackup\TEST.TXT" exit
The easiest is to configure the session in WinSCP GUI and have it generate the command-line for you: https://winscp.net/eng/docs/guide_automation#generating

Reply with quote

Advertisement

You can post new topics in this forum