ForFiles.exe Not Working In Task Scheduler 0x1 Result

log-filestask-schedulerwindows-server-2008

I have no idea why it is not working in Task Scheduler because if I run the same code in a batch file it works fine?

I am putting the following into task scheduler on a Win2008 R2 machine and I keep getting a 0x1 result back??

C:\Windows\System32\forfiles.exe /p C:\inetpub\logs\LogFiles /s /m *.log /d -30 /c "cmd /c del @file"

Any ideas how I can get task schedular to play ball? I am running this with highest privalidges ticked?

Best Answer

A similar BAT works just fine for me when running via task scheduler on my XP machine. I would not focus on the BAT itself and look into the task scheduler. Revise your question to includes the log from task scheduler - you'll probably find an issue with passwords or something. Also, include all the details of the task itself - who it's running as, etc. What do you mean by "I am running this with highest privalidges ticked?"