Topic "uploading a file through command line with SSH"

Author Message
Greg T

Guest


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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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:
http://winscp.net/eng/docs/commandline#syntax
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License