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
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\Temp\*.*" (
attrib -R -A -S -H "%%d\Local Settings\Temp\*.*"
del "%%d\Local Settings\Temp\*.*" /q
)
)
)
)

Published by

Rich

Just another IT guy.

Leave a Reply

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