TUT, Prevent malware/Autoclean it

DoxThis

Level 3
Thread author
Verified
Apr 25, 2015
135
1.Create a .txt file with this inside, then save as anything.bat (Make sure you enable all saving as any file type)
@echo off
del "%TEMP%\*.*" /s /f /q
for /d %%d in (%TEMP%\*) do rmdir "%%d" /s /q
del "%WINDIR%\TEMP\*.*" /s /f /q
for /d %%d in (%WINDIR%\TEMP\*) do rmdir "%%d" /s /q
pause
2. Hit windows key and r, type shell:starup, Drag and drop the bat inside
3. Profit from malware that infect the temp folder
* This will obviously not clean registry etc. It only helps to stop malware that extract to temp
Thanks for the help Nico!

 
Last edited:
  • Like
Reactions: FireShootSK

Ink

Administrator
Verified
Staff Member
Well-known
Jan 8, 2011
22,361
Could you explain what this batch file provides?

What about legitimate programs that use the temp folders?
 

Nico@FMA

Level 27
Verified
May 11, 2013
1,687
Code:
rd %temp% /s /q
md %temp%
Hit Windows key and R then type: shell:startup
You forgot the T.

However you might as well use this:

Code:
@echo off
del "%TEMP%\*.*" /s /f /q
for /d %%d in (%TEMP%\*) do rmdir "%%d" /s /q
del "%WINDIR%\TEMP\*.*" /s /f /q
for /d %%d in (%WINDIR%\TEMP\*) do rmdir "%%d" /s /q
pause

This will mostly clean your temp files.
Yet make sure you run them as admin, because otherwise you get file in use/ or permission errors. That said next time you provide a code write what it does and put it in code tags.

Cheers
 
Last edited:
  • Like
Reactions: FireShootSK

Nico@FMA

Level 27
Verified
May 11, 2013
1,687
Could you explain what this batch file provides?

What about legitimate programs that use the temp folders?

TEMP files by legit programs pile up overtime, there are only a few programs that actually clean them up properly, but usually TEMP folders fill up overtime without being cleaned properly and if legit files are being deleted, then their parent program will regenerate them when needed.
So usually this can be done without risk. YET a note of caution: If you do not know what you are doing then do not use this option and stick to basic windows tools, or proven third party programs like CCleaner, Privazer, Glary tools.

Cheers
 

DoxThis

Level 3
Thread author
Verified
Apr 25, 2015
135
TEMP files by legit programs pile up overtime, there are only a few programs that actually clean them up properly, but usually TEMP folders fill up overtime without being cleaned properly and if legit files are being deleted, then their parent program will regenerate them when needed.
So usually this can be done without risk. YET a note of caution: If you do not know what you are doing then do not use this option and stick to basic windows tools, or proven third party programs like CCleaner, Privazer, Glary tools.

Cheers
Thanks I was on my phone and very tired and I just wanted a post
 

Overkill

Level 31
Verified
Honorary Member
Feb 15, 2012
2,128
TEMP files by legit programs pile up overtime, there are only a few programs that actually clean them up properly, but usually TEMP folders fill up overtime without being cleaned properly and if legit files are being deleted, then their parent program will regenerate them when needed.
So usually this can be done without risk. YET a note of caution: If you do not know what you are doing then do not use this option and stick to basic windows tools, or proven third party programs like CCleaner, Privazer, Glary tools.

Cheers
ATF cleaner does a great job, it cleans alot that ccleaner misses
 

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