Guide | How To Help to creating batch file that will delete all user profile temp files

The associated guide may contain user-generated or external content.

kuttus

Level 2
Thread author
Verified
I need a help to creating a batch file that will delete all the temp files in all user profiles and Temporary Internet Files.

It should delete the temp files of all the user profiles. I will be loged in to one user profile and that one will be having Administrator Privilege... ...

I want the same batch file for both Windows XP and Vista or 7...

One more thing..

It should delete all the files inside

Root Drive\RECYCLER\ (In XP)
Root Drive\$Recycle.Bin (In Windows 7 and Vista )


PS : No Matter if the files and folders inside all of this temp folders are hidden or not. It should Clear everything.
 
You can use TFC - Temp File Cleaner by OldTimer - http://www.geekstogo.com/forum/files/file/187-tfc-temp-file-cleaner-by-oldtimer/
 
Try this:

del "C:\RECYCLER\*.*" - this will delete everything in the folder

C being the root folder and remove the " ".



Another option would be:

set folder="C:\RECYCLER"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)

The 2nd script wont delete the root folder

The 1st one, probably wont due to the wildcards but feel free to test it on a vm or host machine (instead of recycle bin, create a folder in the actual drive for testing).

Oldtimer is also handy but does require some tweaks on scrits (last time I used it)
 
EDIT: Biozfear's method is better for emptying recycle bin. Sorry I got caught be my parents using the WiFi so they hidden it and I saved what I written. I made a hotspot from my phone after they went out to gain access to the internet.. :P

Make sure you temporarily enable showing hidden files and folders including showing protected system files and open the recycler folder. Take the name of the folder inside it.

Writer this in notepad:

@echo off
cls

echo Deleting temporary files and emptying recycle bin...
del %temp%
del %systemdrive%\RECYCLER\name of that folder

Make sure you run as admin on Vista/7 and change the name of the folder.
I am unsure if the method to delete recycle bin works on vista and 7?
 

You may also like...