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: 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.
Shattered

Anyone help?

Hi

Can anyone help with the correct syntax for a scheduled task?

Thank you

Mike
Shattered

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