In case you need to DELete Windows temporary files directory to save some free space on an old PC or (group of PCs) in a raw you might prefer to use this CLI command lines:
DEL /F /S /Q %TEMP%
DEL /f /q /s "%SYSTEMDRIVE%Documents and SettingsLocalServiceCookies*.*"
DEL /f /q /s "%SYSTEMDRIVE%%HOMEPATH%Cookies*.*"
DEL /f /q /s "%SYSTEMDRIVE%Documents and SettingsLocalServiceLocal SettingsTemp*.*"
DEL /f /q /s "%SYSTEMDRIVE%Documents and SettingsNetworkServiceLocal SettingsTemp*.*"
DEL /f /q /s "%SYSTEMDRIVE%Documents and SettingsDefault UserLocal SettingsTemp*.*"
DEL /f /q /s "%SYSTEMDRIVE%%HOMEPATH%Local SettingsTemp*.*"
DEL /f /q /s "%WINDIR%Temp*.*"
DEL /f /q /s "%TEMP%*.*"
DEL /f /q /s "%SYSTEMDRIVE%Documents and SettingsLocalServiceLocal SettingsTemporary Internet Files*.*"
DEL /f /q /s "%SYSTEMDRIVE%%HOMEPATH%Local SettingsTemporary Internet Files*.*"
RD /q /s %TEMP%
RD /q /s %WINDIR%Temp
RD /q /s "%SYSTEMDRIVE%Documents and SettingsDefault UserLocal SettingsTemp"
RD /q /s "%SYSTEMDRIVE%Documents and SettingsLocalServiceLocal SettingsTemp"
RD /q /s "%SYSTEMDRIVE%Documents and SettingsDefault UserLocal SettingsTemp"
RD /q /s "%SYSTEMDRIVE%%HOMEPATH%Local SettingsTemp"
Another helpful thing for MS Windows users is cleaning up Windows Tempory Files on every system restart (reboot); doing so is possible by setting below’s short batch script to exec on every system boot:
@ECHO OFF
IF NOT %temp% == %tmp% GOTO both_
GOTO single
:both
DEL %temp%*.* /F /S /Q
DEL %tmp%*.* /F /S /Q
CLS
ECHO Deleted all files in the TEMP folder: %temp%
ECHO Deleted all files in the TMP folder: %tmp%
GOTO end
:single
DEL %temp%*.* /F /S /Q
CLS
ECHO Deleted all files in the TEMP folder: %temp%
:end
You can download the script clean_windows_temp_files_on_win_start.com here . The script is great tool for Windows administrators of Win Domain Controllers or University / educational M$ Windows based networks, where PC security is at high risk. Setting the script to run on even “non-critical” home PCs is a great idea as it can save you a lot of troubles with SpyWare, Malware Viruses and other Windows targetted “Bad-Wares” 🙂
Cheers 🙂
More helpful Articles
Tags: batch, command, Delete, Files, Temporary, Windows