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

d.gerrardboards

Re: Too many parameters for command 'open'

That's done it! Damn, thought I could put the hostkey in a file.
Thanks for your help
martin

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
d.gerrardboards

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