The problem is that when I use the following:-
-noexit -NoProfile -ExecutionPolicy Bypass -command "& ' C:\Program File(x86)\WinSCP\WinSCP" /ini-nul/script=C:\Users\Glen\Desktop\WinSCP\Downloadscript.txt"I get the following error message;
**The string is missing the terminator:'.
- CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
- FullyQualifiedErrorID : TerminatorExpectedAtEndOfString**
It runs OK in Powershell both ise and V1.0 but will not work using Task Scheduler
Using Windows 10
1 Answer
You have a " instead of ' in your command line. Change it to this:
-noexit -NoProfile -ExecutionPolicy Bypass -command "& 'C:\Program File(x86)\WinSCP\WinSCP' /ini-nul/script=C:\Users\Glen\Desktop\WinSCP\Downloadscript.txt"The winscp parameters seem to be incorrect as well. I assume
/ini-nul/script=...should be
/ini=nul /script=... 3