Windows 2016 Task Manager and SCP with Hostkey

Advertisement

Shattered
Joined:
Posts:
2
Location:
United Kingdom

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Windows 2016 Task Manager and SCP with Hostkey

What you have posted is a batch file. If you want to execute the batch file, you need to specify the path to the batch file in the Scheduler task. Not a path to WinSCP. How do you execute your other tasks?

I do not see what does your question have to do with host key or Pageant. And Pageant has nothing to do with host keys either.

Reply with quote

Advertisement

You can post new topics in this forum