Getting the following per the log file when running the batch file
. 2020-08-07 11:24:23.599 --------------------------------------------------------------------------
. 2020-08-07 11:24:23.599 Using SFTP protocol.
. 2020-08-07 11:24:23.599 Doing startup conversation with host.
> 2020-08-07 11:24:23.599 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2020-08-07 11:24:23.825 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2020-08-07 11:24:23.825 SFTP version 3 negotiated.
. 2020-08-07 11:24:23.825 We believe the server has signed timestamps bug
. 2020-08-07 11:24:23.825 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
. 2020-08-07 11:24:23.825 Getting current directory name.
. 2020-08-07 11:24:23.825 Getting real path for '.'
> 2020-08-07 11:24:23.825 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2020-08-07 11:24:24.048 Type: SSH_FXP_NAME, Size: 97, Number: 16
. 2020-08-07 11:24:24.048 Real path is '/'
. 2020-08-07 11:24:24.048 Startup conversation with host finished.
< 2020-08-07 11:24:24.048 Script: Active session: [1] sftp@vpn.ans.red
> 2020-08-07 11:24:24.048 Script:
> 2020-08-07 11:24:24.048 synchronize
< 2020-08-07 11:24:24.048 Script: Unknown command '
< 2020-08-07 11:24:24.048 synchronize'.
. 2020-08-07 11:24:24.048 Script: Failed
. 2020-08-07 11:24:24.048 Script: Exit code: 1
. 2020-08-07 11:24:24.048 Closing connection.
. 2020-08-07 11:24:24.048 Sending special code: 1
. 2020-08-07 11:24:24.478 Main session channel closed
. 2020-08-07 11:24:24.479 All channels closed
The batch file I have is:
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Projects\Synced-winSCP-Target\sync.log" /ini=nul ^
/command ^
"open sftp://sftp:password@domain.com/ -hostkey=""ssh-rsa 2048 K6kzAwJ+dsOyceO4ewkFmeO31323refefefef="" -rawsettings ProxyPort=0" ^
synchronize both "C:\Projects\Synced-winSCP-Target" /Proofpoint_Corp_Personal Archive/Synced-via-WinSCP-Script
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%
Note: FYI, authentication shows successful, it's only the command is not running as expected.
. 2020-08-07 11:24:22.936 Server offered these authentication methods: password,publickey
. 2020-08-07 11:24:22.936 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2020-08-07 11:24:22.936 Using stored password.
. 2020-08-07 11:24:22.936 Sent password
. 2020-08-07 11:24:23.171 Access granted
. 2020-08-07 11:24:23.171 Opening main session channel
. 2020-08-07 11:24:23.388 Opened main channel
. 2020-08-07 11:24:23.599 Started a shell/command
. 2020-08-07 11:24:23.599
--------------------------------------------------------------------------
Any idea?