Cleanup All Users’ Temporary Files

This script simply cleans up all users’ temporary files and temporary internet files.

This works on Windows XP, Windows Server 2003.

@echo off

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.