batch file to remove temporary files and empty recycle bin

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
shiva
Posts: 18
Joined: 11 Jul 2011 03:53

batch file to remove temporary files and empty recycle bin

#1 Post by shiva » 11 Jul 2011 04:41

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 :)

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

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

#2 Post by Ed Dyreen » 11 Jul 2011 06:58

'
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 :)

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

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

#3 Post by Cleptography » 11 Jul 2011 17:12

Stupid reg keys preventing deletes. Go root kit yourself to hell'o' operator dial number nine.

Post Reply