If your scheduled task is not running on Windows Server 2008/2012 but working in command line, try the following trick.
This is a common issue in Windows Server 2008/2012, but it’s many times very hard to figure out why your batch files run in command line while they do not execute when scheduled as automated tasks in Windows Task Scheduler.
To fix the issue:
– right click on your scheduled task
– select properties
– go to Actions tab
– highlight the Action and press EDIT button
– Make sure START IN (OPTIONAL) option is filled in, similar to this screenshot:
It should all work now!