Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a SCHEDULED TASK that will kick off a FORFILE loop, and terminate the process after an hour (or 12 hours). I expect there to be MILLIONS of files the the paths defined, and I want to run the task off-hours to minimize the performance impact.

The code I'm trying to run is:

forfiles /P "E:\Mutex_01" /S /M *.txt /D -5 /C "cmd /c del @path"

Looking in the logs, I don't get the sense that task is running correctly. When I enumerate the folder, there is no change. Am I missing something? How can I become the expected result?

share|improve this question
up vote 1 down vote accepted

Personally I would do it differently... I would kick off the routine interactively and then schedule a script that has:

PSKILL forfiles.exe

Schedule that script to run at a particular time with administrative credentials.

You could even do a test right now... start the forfiles routine, and schedule your kill script to run five minutes from now...

share|improve this answer
This worked! Not allowed to use PSKill (even though it is a Sysinternals product), but was able to use it with TASKKILL. Thanks! – Jerry Sweeton Apr 8 '13 at 21:24

Your Answer


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.