Friday, March 9, 2007

Tutorial - Automated cleanup of windows temparory files

Most of the windows user have this big problem that how to automate the cleanup of temporary files on system drive.i was also wondering about this but then i read some commands of dos and finally got the solution.some people use third party tools to cleanup.But for cleanup you don't need to do anything.just make a small batch file and run when ever you want to cleanup.

here is the code
cd C:\Documents and Settings\Username\Recent
del *.* /Q

cd %temp%
del *.* /Q

cd %windir%/temp
del *.* /Q

cd C:\Documents and Settings\Username\Local Settings\Temporary Internet Files

del *.* /Q /S
Now this just deletes all files which are temporary. You can also add c:\windows\prefetch folder which is also not needed.It also contains useless files and waste your memory.
cd c:\windows\prefetch
del *.* /Q
Ok,but what baout system restore? i have solution for that also.

on command prompt write
cd c:\systenm vol*
now you will be in 'System Volume Information' folder.then write
cd _restore*
and then type
dir /b RP*>c:\1.txt
so it will store all the dir list in _restore.... folder in file c:\1.txt
then run a for loop on that files lines.

say
dir /b RP*>c:\1.txt
for /F %%i in (c:\1.txt) do RD %%i /Q /S
this will delete all RP* directories from restore folder and your hard drive will be clean.

now the whole code at once for your help.
c:
cd C:\Documents and Settings\username\Recent
del *.* /Q

cd %temp%
del *.* /Q

cd %windir%/temp
del *.* /Q

cd C:\Documents and Settings\username\Local Settings\Temporary Internet Files
del *.* /Q /S

cd c:\system vol*
cd _restore*

dir /b RP*>c:\1.txt

for /F %%i in (c:\1.txt) do RD %%i /Q /S

cls
cd c:
exit

Please Rate this. Leave you comments.

0 Comments: