Batch Script to Cleanup Temporary Files

This script is intended for use on Windows XP / Server 2003.

@echo off
setlocal

@for /d %%d in ( C:\Documents and Settings\* ) do @(
  echo %%d
  if exist %%d\Local Settings\ (
    if exist %%d\Local Settings\Temp (
      for /d %%e in ( %%d\Local Settings\Temp\* ) do @(
        attrib -R -A -S -H %%e\*.*
        rmdir %%e /s /q
      )

      if exist %%d\Local Settings\Temporary Internet Files (
        rmdir %%d\Local Settings\Temporary Internet Files /s /q
      )

      if exist %%d\Local Settings\Temp\*.* (
        attrib -R -A -S -H %%d\Local Settings\Temp\*.*
        del %%d\Local Settings\Temp\*.* /q
      )
    )
  )
)