Cleanup All Users’ Temporary Files

This content 8 years old. Please, read this page keeping its age in mind along with the fact technology changes fast and the information on this page me be outdated, not best practice, or plain wrong.

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

This works on Windows XP, Windows Server 2003.

@echo off
setlocal

@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
      )
    )
  )
)

Speak Your Mind

*

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