Windows 2016 Task Manager and SCP with Hostkey
Afternoon all
I have a variety of WinSCP scripts triggered by Task Manager which work perfectly. All scripts are accessing SFTP sites and downloading csv files.
I am currently struggling with a script using a hostkey using Pageant that works perfectly as a script but not when triggered by Task Manager. Could someone cast an eye over the code and let me know where I appear to be going wrong.
As mentioned the script works perfectly but when adding WinSCP path to the Task then adding in the syntax into Parameter it does not execute.
@echo off
"E:\SFTP_Software\WinSCP\WinSCP.com" ^
/command ^
"open sftp://***@*******/ -hostkey=""ssh-*********************""" ^
"cd /****/****/******/" ^
"lcd **********" ^
"mget /********/*.csv" ^
"cd /**********" ^
"get *.csv" ^
"cd /**********" ^
"put *.csv" ^
"rm /*********/*.csv" ^
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
close
exit
Thank you
Mike
I have a variety of WinSCP scripts triggered by Task Manager which work perfectly. All scripts are accessing SFTP sites and downloading csv files.
I am currently struggling with a script using a hostkey using Pageant that works perfectly as a script but not when triggered by Task Manager. Could someone cast an eye over the code and let me know where I appear to be going wrong.
As mentioned the script works perfectly but when adding WinSCP path to the Task then adding in the syntax into Parameter it does not execute.
@echo off
"E:\SFTP_Software\WinSCP\WinSCP.com" ^
/command ^
"open sftp://***@*******/ -hostkey=""ssh-*********************""" ^
"cd /****/****/******/" ^
"lcd **********" ^
"mget /********/*.csv" ^
"cd /**********" ^
"get *.csv" ^
"cd /**********" ^
"put *.csv" ^
"rm /*********/*.csv" ^
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
close
exit
Thank you
Mike