"D:\directory\WinSCP\WinSCP.com" /command "option batch abort" "option confirm off" "open sftp://email@example.com/ -privatekey=""D:\directory\subdir\privatekey.ppk"" -passphrase=""passphrase"" " "cd /custom" "get *.*" "rm *.*" "close" "exit"
I've tried setting up the scheduled task with "D:\directory\WinSCP\WinSCP.com" as the program to run, and the /command switch and its parameters and arguments in the Add arguments field, and setting the Start In field to where I want the downloaded files written. I've also tried putting the script in a batch file and setting the batch file as the program for Task Scheduler to run. No joy in either case. But the script itself runs just fine from the command line, as does the batch file.
This script and the scheduled task had been working fine for months before recently changing to use RSA w/passphrase instead of a password. Task Scheduler isnt offering much in the way of clues about where its failing. The best indicator of the problem is that it sits and waits for a minute or so before finally failing, which makes me think its timing out on something, and most likely the passphrase since that's the new piece.
Any help appreciated!