Batch file works when launched manually but not from Task Scheduler
I have a batch file that gathers files into some standard folders and then loops through the folders to upload them and their contents with this line:
The batch file runs perfectly when run manually, as well as when "run as" 'AnotherUser'. But when I run it from a Windows Task Schedule that itself "runs as" 'AnotherUser', it all runs as expected except that WinSCP doesn't do anything. I can see from a batch file process log that the WinSCP command is called for each folder, but nothing gets added to the default WinSCP.log and nothing gets uploaded.
If I had to guess, I'd say it's a permissions issue, but 'AnotherUser' has full control over WinSCP and all the scripts and files to upload, etc. Plus, the script schedule is theoretically running as the same user as when I run it manually.
Thoughts?
for /D %%a in ("ToSend\*") do ( "C:\Program Files\WinSCP\WinSCP.com" /command "open myFTPserver" "put %%a" "exit" )
If I had to guess, I'd say it's a permissions issue, but 'AnotherUser' has full control over WinSCP and all the scripts and files to upload, etc. Plus, the script schedule is theoretically running as the same user as when I run it manually.
Thoughts?