Hi Martin
I'm trying to automate file transfers using a batch file and a script file as per your instructions in
"Automate file transfers (or synchronization) to FTP server or SFTP server".
This is my batch file (TESTscript.bat):
winscp.com /script=TESTscript.txt /ini=nul /log=TESTscript.log
My script file (TESTscript.txt) looks like this (my original file has of course proper credentials etc.):
# Connect to SFTP server using a password
open sftp://user:password@example.com/ -hostkey="ssh-ed25519 xxxxx..."
# Synchronize files
put D:\000-Download-Auf-D\7-ZipPortable\--TestFTP.txt /xxxxx/xx/xx/xxxxxxxx/home/ftp/Test
# Exit WinSCP
exit
With the right credentials and ssh-key WinSCP connects to the SFTP server like a charm. No problems there.
But then the script just exits. It doesn't seem to find the
put
-command (nor
synchronize remote
-command which I tried as well) .
TESTscript.log
after logging successful connection shows the following:
. 2024-10-25 10:29:22.475 Startup conversation with host finished.
< 2024-10-25 10:29:22.475 Script: Session started.
< 2024-10-25 10:29:22.476 Script: Active session: [1] user.example.com
> 2024-10-25 10:29:22.477 Script: ssh-ed25519 255 xxxxx..."
< 2024-10-25 10:29:22.477 Script: Unknown command 'ssh-ed25519'.
. 2024-10-25 10:29:22.477 Script: Failed
. 2024-10-25 10:29:22.477 Script: Exit code: 1
. 2024-10-25 10:29:22.477 Closing connection.
. 2024-10-25 10:29:22.477 Sending special code: 1
. 2024-10-25 10:29:22.480 Session sent command exit status 0
. 2024-10-25 10:29:22.480 Main session channel closed
. 2024-10-25 10:29:22.480 All channels closed
I am particularily confused by
> 2024-10-25 10:29:22.477 Script: ssh-ed25519 255 xxxxx..."
< 2024-10-25 10:29:22.477 Script: Unknown command 'ssh-ed25519'.
I vaguely suspect that I'm doing something wrong with the double-quotes but I tried every possible variation of double-quoting to no avail. There are no blank spaces in my paths anyways.
I'd appreciate your help very much.
(I'm on Windows Server 2016 using WinSCP 6.3.5 Portable)