Topic "uploading a file through command line with SSH"

Author Message
Greg T


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 s -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...
Using username "user".
Authenticating with pre-entered password.
Starting the session...
Reading remote directory...
Session started.
Active session: [1]
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 s -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
put -nopreservetime tester.txt

so I'm thinking it's syntax at this point. I just don't see it at this point. Any help?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27083
Location: Prague, Czechia
You need to double the double-quotes around command arguments:
winscp /command "option batch abort" "option confirm off" "open s -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"

Martin Prikryl

You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License