My batch file for WinSCP only works with the hostkey but not with the privatekey

Advertisement

justinfraz
Joined:
Posts:
1
Location:
Melbourne

My batch file for WinSCP only works with the hostkey but not with the privatekey

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="D:\CoinFTP\Logs\Practifi_Logs\Log.txt" /ini=nul ^
/command ^
"open sftp://johnb@revex.com.au@ftp.hostedftp.com/ -privatekey=""D:\CoinFTP\KeyFiles\Practifi_PrivateKeyFile.ppk""" ^
"put -nopreservetime D:\CoinFTP\Data\Practifi\*" ^
"exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
cmd /c move /Y D:\CoinFTP\Data\Practifi\*.* D:\CoinFTP\Backup\Practifi_Backups
) else (
echo Error
)

exit /b %WINSCP_RESULT%

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
30,704
Location:
Prague, Czechia

Re: My batch file for WinSCP only works with the hostkey but not with the privatekey

Well, you didn't post any error message nor a log file.

Though for sure, you need the -hostkey switch. A "private key" is not a replacement for a "host key". Read this to understand:
https://winscp.net/eng/docs/ssh_keys

Reply with quote

Advertisement

You can post new topics in this forum