Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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
justinfraz

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%