Delete Temp Files for Each User Profile on Windows
I’ve had this batch file lying around for a while now, it comes in useful from time to time. On Windows machines with many users, sometimes it’s nice to clean out the temp and temporary internet folders once in a while. This is especially useful on Terminal Server where there can be many profiles with temporary files eating up disk space.
This script cycles through each user profile in the “documents and settings” folder and removes temp files. I’ve adapted this script in the past to perform other tasks on users profiles which has proven to be a good time saver.
CleanProfileTemp.bat
@echo off
cd /D C:\Documents and SettingsREM —-Clean Temp Folder—
for /D %%a in (*.*) do DEL /F /Q “%%a\Local Settings\Temp\*.*”
for /D %%a in (*.*) do FOR /D %%b IN (”%%a\Local Settings\Temp\*.*”) DO RMDIR /S /Q “%%b”REM —-Clean IE Cache—
for /D %%a in (*.*) do DEL /F /Q “%%a\Local Settings\Temporary Internet Files\*.*”
for /D %%a in (*.*) do FOR /D %%b IN (”%%a\Local Settings\Temporary Internet Files\*.*”) DO RMDIR /S /Q “%%b”pause