Post a reply

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)


Topic review


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.

Anyone help?


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

Thank you


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\" ^
/command ^
"open sftp://***@*******/ -hostkey=""ssh-*********************""" ^
"cd /****/****/******/" ^
"lcd **********" ^
"mget /********/*.csv" ^

"cd /**********" ^
"get *.csv" ^
"cd /**********" ^
"put *.csv" ^

"rm /*********/*.csv" ^

if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error



Thank you