My application has a code part like that:
if (!Directory.Exists(datePath))
{
Directory.CreateDirectory(datePath);
}
If I double click and run exe, it works and creates folders.
But when I take my application to task scheduler and set to run every day, the code doesn't work. No error, nothing.
Even if I right click on task and run it manually, it doesn't work.
I use my other applications with task scheduler and they work fine. I don't understand why this one doesn't create directories....
Tying the comment on your question and your comment on my now-removed answer together:
You see path is
E:\Engineering\2014\December
. E: is a mapped drive to\\server\share
.I used server admin user and password for the Scheduled Task
That user has no mapped drives on your machine. Use the full UNC path:
string datePath = @"\\server\share\Engineering\..."