New
#1
Batch file to cleanup OS temp and junk files.
I am one who likes to keep my computers clean and running smoothly. All my files/folders etc are super organised and tidy [and yes, I do have OCD].
On a weekly basis I run ...
[1] Extended Disk Cleanup using a batch file.
[2] CCleaner [excluding the registry cleaner].
[3] Glary Utilities [excluding the registry cleaner].
[4] Clear ALL the Event Viewer logs using a batch file.
Note: Before anyone mentions the fact that these logs are useful if a problem arises for troubleshooting, I know that, and this is not the point of this post.
[5] Defragment.
[6] AVG.
[7] Malwarebytes.
[8] Backup my data etc.
Although the above does a great job, I wondered if creating a batch [.bat] file to remove ALL the temp and junk files that the above doesn't do would also be of an advantage!
I investigated this option and found many many scripts that claim that they do this with no detrimental downside or knock on affect at all. I tried some that stated this and they certainly didn't do what was stated and expected and they certainly did have a detrimental downside or knock on affect. In these cases I just restored my customised master system image [takes about 10 minutes].
Here is a script [I have just changed it slightly] that I ran on my Vista test computer that seems/appears to be quite good. I have attached the output given.
WARNING: Do NOT run the script below unless you understand batch script and know exactly what it will do. If you do run it, I advise you to make a System Image FIRST, just in case of problems or it has a detrimental downside or knock on affect!
Source => Computer Junk Files Cleaner – DIY Small Tool To Clean Junk Files In Computer.
Results produced from the above run on my test system => Clean System Junk Files - RESULTS.txt.Code:@echo off if not "%1" == "max" start /MAX cmd /c %0 max & exit/b echo. echo Cleaning system junk files, please wait . . . echo. del /f /s /q %systemdrive%\*.tmp del /f /s /q %systemdrive%\*._mp del /f /s /q %systemdrive%\*.log del /f /s /q %systemdrive%\*.gid del /f /s /q %systemdrive%\*.chk del /f /s /q %systemdrive%\*.old del /f /s /q %systemdrive%\recycled\*.* del /f /s /q %windir%\*.bak del /f /s /q %windir%\prefetch\*.* rd /s /q %windir%\temp & md %windir%\temp del /f /q %userprofile%\cookies\*.* del /f /q %userprofile%\recent\*.* del /f /s /q “%userprofile%\Local Settings\Temporary Internet Files\*.*” del /f /s /q “%userprofile%\Local Settings\Temp\*.*” del /f /s /q “%userprofile%\recent\*.*” echo. echo Junk files clean is finished! echo. & pause
I just wondered what you think about ...
[1] What it cleans.
[2] Whether or not it should clean what it does.
[3] Is there any detrimental downside or knock on affect.
[4] Are there any other items that can be safely included.
I have a few more items that could possibly be added which I may post at a later stage depending on the feedback received with regard to the above!
Thanks.
Last edited by Paul Black; 07 Jul 2019 at 03:11. Reason: Added WARNING!