Batch file works when launched manually but not from Task Scheduler

Advertisement

howards
Joined:
Posts:
1

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:
for /D %%a in ("ToSend\*") do (
"C:\Program Files\WinSCP\WinSCP.com" /command "open myFTPserver" "put %%a" "exit"
)
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?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Batch file works when launched manually but not from Task Scheduler

Did you try to enable logging explicitly using /log command-line switch (instead of relying on the global configuration)?
https://winscp.net/eng/docs/commandline#logging

See also:

Reply with quote

Advertisement

You can post new topics in this forum