Page 1 of 1

batch file to remove temporary files and empty recycle bin

Posted: 11 Jul 2011 04:41
by shiva
hai i have a batch file that clears all the temperary data in 3 places,

they are
C:\WINDOWS\system32\Temp
C:\documents&sett\user\LOCALS~1\Temp
C:\WINDOWS\Prefetch
these are the area known,
if any one knows the other locations add the locations,
i am unable to empty recycle bin,
help in this concern,


the batch file i had was

del /s /f /q %windir%\temp\*.*
del /s /f /q %temp%\*.*
del /s /f /q %windir%\Prefetch\*.*


thank you
shiva :D :)

Re: batch file to remove temporary files and empty recycle b

Posted: 11 Jul 2011 06:58
by Ed Dyreen
'
This often causes me problems, I try to reduce the risk of failure, I:
-run the batch as administrator ( runas /? )
-become the owner of the files and directories ( cacls /? )
-remove all 'special' attributes ( attrib /? )
-attempt a delete ( rdf /? del /? )
-schedule a delete to run after reboot if previous fails... ( regedit /? )

Additionaly a folder can be prevented to be deleted if you add it as a key in the registry..
I forgot how to do this, and like to include it myself, I should :)

Re: batch file to remove temporary files and empty recycle b

Posted: 11 Jul 2011 17:12
by Cleptography
Stupid reg keys preventing deletes. Go root kit yourself to hell'o' operator dial number nine.