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: uploading a file through command line with SSH

You need to double the double-quotes around command arguments:
winscp /command "option batch abort" "option confirm off" "open sftp://user:password@remotesite.com -hostkey=""ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx""" "put -nopreservetime tester.txt" "exit"

See:
https://winscp.net/eng/docs/commandline#syntax
Greg T

uploading a file through command line with SSH

Been wrestling with this all morning and hit a point where I need to raise my hand for some assistance.
Here is my line I'm running and output

winscp /command "option batch abort" "option confirm off" "open sftp://user:password@remotesite.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" "put -nopreservetime tester.txt" "exit"
Searching for host...
Host does not exist
batch abort
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] user@remotesite.com
Unknown command '1024'.

when I run it in these chunks it works without issue. Just combined it complains. Any thoughts?
winscp /command "option batch abort" "option confirm off"
open sftp://user:password@remotesite.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
put -nopreservetime tester.txt
exit

so I'm thinking it's syntax at this point. I just don't see it at this point. Any help?