How to get Task Scheduler to run BAT correctly
Posted on 2014-09-23
I have a scheduled task to run a BAT file that is suppose to delete some files at 9:00 PM daily. The OS is Windows Server 2012. The task starts and runs with the account that the task is using. I have logged into the server with a different account and scheduled a time for it to start and it starts and the BAT deletes the files. So, all is good. However, when no one is logged into the server and when 9:00 PM comes around the task starts, but the del command in the BAT fails to delete the files. I have set the task to "Run with highest privileges" and run whether user is logged on or not. But, the del command does not remove the files. Here is the del command:
del \\server\d$\SQL-Backups\*.bak /f /q
Any ideas on what could be going on?