Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have no idea why its 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?

share|improve this question
    
I am hitting the same problem on multiple Windows 2008 servers with batch files containing forfiles. I am also running with highest privileges. The batch file runs just fine outside of the task scheduler. Sounds like the same problem you are seeing. Have you found a solution to the problem yet? If so, I would be grateful to hear it. Thanks! John. –  user90544 Aug 4 '11 at 18:46
add comment

1 Answer 1

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?"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.