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
Oct 5, 2012
2,697
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.
 

Jack

Administrator
Verified
Staff Member
Well-known
Jan 24, 2011
9,378
You can use TFC - Temp File Cleaner by OldTimer - http://www.geekstogo.com/forum/files/file/187-tfc-temp-file-cleaner-by-oldtimer/
 

kuttus

Level 2
Thread author
Verified
Oct 5, 2012
2,697
Actually jack I am looking for one batch file.... I am not supposed to use any 3rd part .exe files in the computers due to Company Policy.
 
P

Plexx

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)
 

WinAndLinuxTutorials

Level 4
Verified
Honorary Member
Aug 23, 2011
2,291
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?
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top