Windows Task Scheduler doesn't start batch file task
Make sure you set the 'Start in' and 'Program/script' options correctly. If your file address is: C:\Temp\foo.bat, set the 'start in' option to 'C:\Temp' and the 'Program/script' option to 'foo.bat'.
To set the 'Start in' option: Right click task in the task scheduler > Properties > Actions > Edit.
If this alone doesn't work then try moving the .bat file to a directory with basic permissions (maybe a shared directory for example).
I had a problem where my .bat file was located in a folder with some restrictive permissions on it, so that only my user account could access it. Even though I had set up the task scheduler to use my credentials it still failed. Moving the .bat file to another directory sorted the issue.
Wasted a lot of time on this silly issue!
add a cd command to where your batch file resides at the first line of your batch file and see if it resolves the issue.
cd D:\wherever\yourBatch\fileIs
TIP: please use absolute paths, relative paths ideally should not be an issue, but scheduler has an difficult time understanding them.
This is a pretty old thread but the problem is still the same -
I tried multiple things, none of them worked -
- Added a Start In Path (without quotes)
- Removed the complete path of the batch file in the Program/Script field etc
- Added
C:\Windows\system32\cmd.exe
to the Program and added/c myscript.bat
to the arguments field.
This is what worked for me -
Program/Script Field - cmd
Add Arguments - /c myscript.bat
Start In : Path to myscript.bat
I had the same problem. I believe it's a privilege problem. If you have "Run only when user is logged on" selected, then it won't happen.
You've hopefully figured it out by now, but I wanted to register it here for the next person who has wasted hours on this.
I was running this on a Windows Server OS. I worked for hours, only to find that the problem was that I had checked the "Run with highest privileges" checkbox. When checked on, it removes all drive mappings. And my .bat file was on the network.