Batch Command "put" not working

Advertisement

jdombrowski
Joined:
Posts:
1

Batch Command "put" not working

Having an issue putting a file. I have everything connecting with the command, and I can drag/drop the file using the GUI.

Here is my command:

WinSCP.exe /log=c:\localfolder\winscp.log /command -open sftp://[user]:[pass]@ftp.server.com:9922/ -hostkey="ssh-rsa 2048 ho:st:ke:yy" -put "C:\Localfolder\file.csv /" "exit"

I've also tried with "put C:\localfolder\file.csv /" also. And not having the "/" for the put command. Same thing happens, it skips the put command.

Here is the revelent part of the log (after the SSH and ssh key connection):

. 2018-01-15 11:27:12.883 Access granted
. 2018-01-15 11:27:12.883 Opening session as main channel
. 2018-01-15 11:27:12.945 Opened main channel
. 2018-01-15 11:27:13.102 Started a shell/command
. 2018-01-15 11:27:13.102 --------------------------------------------------------------------------
. 2018-01-15 11:27:13.102 Using SFTP protocol.
. 2018-01-15 11:27:13.102 Doing startup conversation with host.
> 2018-01-15 11:27:13.102 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2018-01-15 11:27:13.164 Type: SSH_FXP_VERSION, Size: 124, Number: -1
. 2018-01-15 11:27:13.164 SFTP version 3 negotiated.
. 2018-01-15 11:27:13.164 Unknown server extension posix-rename@openssh.com="1"
. 2018-01-15 11:27:13.164 Supports statvfs@openssh.com extension version "2"
. 2018-01-15 11:27:13.164 Unknown server extension fstatvfs@openssh.com="2"
. 2018-01-15 11:27:13.164 Supports hardlink@openssh.com extension version "1"
. 2018-01-15 11:27:13.164 We believe the server has signed timestamps bug
. 2018-01-15 11:27:13.164 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2018-01-15 11:27:13.164 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2018-01-15 11:27:13.164 Getting current directory name.
. 2018-01-15 11:27:13.164 Getting real path for '.'
> 2018-01-15 11:27:13.164 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2018-01-15 11:27:13.242 Type: SSH_FXP_NAME, Size: 51, Number: 16
. 2018-01-15 11:27:13.242 Real path is '/home/folder'
. 2018-01-15 11:27:13.242 Startup conversation with host finished.
< 2018-01-15 11:27:13.242 Script: Active session: [1] user@ftp.server.com:9922
. 2018-01-15 11:27:13.242 Script: Exit code: 0
. 2018-01-15 11:27:13.242 Closing connection.
. 2018-01-15 11:27:13.242 Sending special code: 12
. 2018-01-15 11:27:13.242 Sent EOF message

You can see that I get "Active Session", then the exit code.

Any help is appreciated.

John Dombrowski

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,527
Location:
Prague, Czechia

Re: Batch Command "put" not working

Your syntax is wrong.

It should be:
WinSCP.exe /log=c:\localfolder\winscp.log /command "open sftp://[user]:[pass]@ftp.server.com:9922/ -hostkey=""ssh-rsa 2048 ho:st:ke:yy""" "put ""C:\Localfolder\file.csv"" /" "exit"
See https://winscp.net/eng/docs/commandline

Reply with quote

Advertisement

You can post new topics in this forum