There's an excellent way to delete all but a certain number of log files based on date. Make a .bat file with this in it:

forfiles /p C:/WINDOWS/system32/Logfiles/W3SVC1 /m *.log /d -10 /c "cmd /c echo @FILE"

What this says is:

For all files in this directory (Windows logs for web server), with names matching *.log, more than 10 days old, execute this command "echo @FILE".

In our case, we want to remove files that have already been sent to, (marked as .old, instead of .log), so we use this first one to test:

forfiles /p C:/WINDOWS/system32/Logfiles/W3SVC1 /m *.old /d -10 /c "cmd /c echo @FILE"

Execute this from the command prompt, and you'll see the list of files to be deleted.

If this is right, then change the .bat file as follows.

forfiles /p C:/WINDOWS/system32/Logfiles/W3SVC1 /m *.log /d -10 /c "cmd /c del @FILE"

and then schedule it to run at 5:55 or something early, but long after midnight, since that's when the logs get renamed and sent to stats.

Note: this does not work on Windows 2000 and older boxes. Use the attached forfiles.exe


To kill a task via it's name, use this line
taskkill /F /IM pscp.exe
You can also use this for a variety of other task ending scenarios.



Only available in the resource kit, this is what you have to use on Win2K and NT4
usage: KILL [options] <<pid> | <pattern>>*

[options]: -f Force process kill