Directory.GetCurrentDirectory() + "\\" + mailFile;
Running the script manually would produce the desired result by loading the file and moving along. Running the same script using the Task Scheduler would try to load the file from C:\Windows\system32\.
Easy fix: Ensure you have the path where the executable resides in the “Start in (optional)” text box within the Task Scheduler.
An alternative solution is to use reflection as well as several other methods, but modifying the task was easier than modifying code…
No comments:
Post a Comment