A DIY Cleanup

The Shadow 2023

Well-known member
Joined
Jan 22, 2023
Messages
370
Reaction score
60
I'm still doing little tweaks to my Cleanup.bat program, although most of the hard work is done.
About once a week now, I get a request for my Batch file from some forum member or another.

I've sent Many copies by email and a couple via Team Viewer. It's still FREE and available to anyone who asks for it.

I still run it daily, or almost daily, and it still removes thousands of Junk files on every run.

Since I first opened this thread, my little DIY cleanup program has removed over a Million junk files from my SSD.

I'm now running Win-11/Pro/64, 24H2, from X-Lite. It's really small, really FAST, and, I love it!

Cheers Mates,
Shadow :cool:
 

thepcformula

Member
Joined
Aug 19, 2024
Messages
8
Reaction score
0
I'm still doing little tweaks to my Cleanup.bat program, although most of the hard work is done.
About once a week now, I get a request for my Batch file from some forum member or another.

I've sent Many copies by email and a couple via Team Viewer. It's still FREE and available to anyone who asks for it.

I still run it daily, or almost daily, and it still removes thousands of Junk files on every run.

Since I first opened this thread, my little DIY cleanup program has removed over a Million junk files from my SSD.

I'm now running Win-11/Pro/64, 24H2, from X-Lite. It's really small, really FAST, and, I love it!

Cheers Mates,
Shadow :cool:
Hi. I was wondering if you could share with me the bat?
 

The Shadow 2023

Well-known member
Joined
Jan 22, 2023
Messages
370
Reaction score
60
Sure! Glad to!
Just two questions first.
1. What browser are you using?
2. What is your OS, Build #, etc.
 
Last edited:

thepcformula

Member
Joined
Aug 19, 2024
Messages
8
Reaction score
0
Sure! Glad to!
Just two questions first.
1. What browser are you using?
2. What is your OS, Build

(Browsers)
Thorium
Chrome
________________
(OS)

Windows 11 Pro x64
_________________
(Build)

10.0.22631 Build 22631
_________________
(Motherboard)

Manufacturer: Gigabyte

Model: Z270P-D3-CF
__________________
(Processor)
Intel Core i7-6700K
___________________
(Graphics)
NVIDIA GeForce GTX 1070
____________________
(Resolution)
1920 x 1080 x 74 hertz

**Anything else you need from me just ask**
 

The Shadow 2023

Well-known member
Joined
Jan 22, 2023
Messages
370
Reaction score
60
My Cleanup program is set to delete the TIF's from Chrome, Edge and Firefox. And maybe even 'Waterfox', a neat little browser patterned after Firefox.
I know nothing of Thorium!

I did ask about the OS, just to establish that you are indeed running some version of Windows. My program is not dependent on any special Build #. If you're using some browser other than the common ones, then my program would not do you as much good, as if you were running "Firefox" for instance, or even "Edge".
Every Browser codes their TIF's in a different manner and then stores them in a different place, so to Clean House, you need the exact location of where your browser stores its TIF's.
 

thepcformula

Member
Joined
Aug 19, 2024
Messages
8
Reaction score
0
My Cleanup program is set to delete the TIF's from Chrome, Edge and Firefox. And maybe even 'Waterfox', a neat little browser patterned after Firefox.
I know nothing of Thorium!

I did ask about the OS, just to establish that you are indeed running some version of Windows. My program is not dependent on any special Build #. If you're using some browser other than the common ones, then my program would not do you as much good, as if you were running "Firefox" for instance, or even "Edge".
Every Browser codes their TIF's in a different manner and then stores them in a different place, so to Clean House, you need the exact location of where your browser stores its TIF's.
Thorium browser is opensource.
**I am using Chrome, Edge, and Firefox now. Hopefully I can use your program now.**
 

thepcformula

Member
Joined
Aug 19, 2024
Messages
8
Reaction score
0
@echo off
:: Request Admin privileges
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo:
echo =============================
echo This script requires Admin rights.
echo Please run as Administrator.
echo =============================
pause
exit
)

:: Header
echo =============================
echo Windows Cleanup and Optimization
echo =============================

:: ========================================
:: 1. Clean Temporary Files from System and User Locations
:: ========================================
echo Cleaning temporary files...

:: System Temp Folder
del /s /q /f %temp%\*.* >nul 2>&1
del /s /q /f C:\Windows\Temp\*.* >nul 2>&1

:: Windows Prefetch
del /s /q /f C:\Windows\Prefetch\*.* >nul 2>&1

:: Windows Logs
del /s /q /f C:\Windows\Logs\*.* >nul 2>&1

:: User Temp Folders
for /d %%x in (%userprofile%\AppData\Local\Temp\*) do rd /s /q "%%x" >nul 2>&1
for /d %%x in (%userprofile%\AppData\Local\Microsoft\Windows\INetCache\*) do rd /s /q "%%x" >nul 2>&1
del /s /q /f %userprofile%\AppData\Local\Temp\*.* >nul 2>&1
del /s /q /f %userprofile%\AppData\Local\Microsoft\Windows\INetCache\*.* >nul 2>&1

:: ========================================
:: 2. Clear Browser Caches
:: ========================================
echo Clearing browser cache...

:: Google Chrome
if exist "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache\*" (
del /s /q /f "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache\*.*" >nul 2>&1
del /s /q /f "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Code Cache\*.*" >nul 2>&1
del /s /q /f "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\GPUCache\*.*" >nul 2>&1
echo Google Chrome cache cleaned.
)

:: Microsoft Edge
if exist "%userprofile%\AppData\Local\Microsoft\Edge\User Data\Default\Cache\*" (
del /s /q /f "%userprofile%\AppData\Local\Microsoft\Edge\User Data\Default\Cache\*.*" >nul 2>&1
del /s /q /f "%userprofile%\AppData\Local\Microsoft\Edge\User Data\Default\Code Cache\*.*" >nul 2>&1
del /s /q /f "%userprofile%\AppData\Local\Microsoft\Edge\User Data\Default\GPUCache\*.*" >nul 2>&1
echo Microsoft Edge cache cleaned.
)

:: Mozilla Firefox
if exist "%userprofile%\AppData\Local\Mozilla\Firefox\Profiles\*" (
for /d %%x in ("%userprofile%\AppData\Local\Mozilla\Firefox\Profiles\*") do (
del /s /q /f "%%x\cache2\*.*" >nul 2>&1
del /s /q /f "%%x\offlineCache\*.*" >nul 2>&1
)
echo Mozilla Firefox cache cleaned.
)

:: Waterfox
if exist "%userprofile%\AppData\Local\Waterfox\Profiles\*" (
for /d %%x in ("%userprofile%\AppData\Local\Waterfox\Profiles\*") do (
del /s /q /f "%%x\cache2\*.*" >nul 2>&1
del /s /q /f "%%x\offlineCache\*.*" >nul 2>&1
)
echo Waterfox cache cleaned.
)

:: Other Browsers
:: Thorium
if exist "%userprofile%\AppData\Local\Thorium\User Data\Default\Cache\*" (
del /s /q /f "%userprofile%\AppData\Local\Thorium\User Data\Default\Cache\*.*" >nul 2>&1
echo Thorium cache cleaned.
)

:: Opera
if exist "%userprofile%\AppData\Roaming\Opera Software\Opera Stable\Cache\*" (
del /s /q /f "%userprofile%\AppData\Roaming\Opera Software\Opera Stable\Cache\*.*" >nul 2>&1
echo Opera cache cleaned.
)

:: Brave
if exist "%userprofile%\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Cache\*" (
del /s /q /f "%userprofile%\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Cache\*.*" >nul 2>&1
echo Brave cache cleaned.
)

:: Continue with additional browsers (Floorp, Chromium, Vivaldi, etc.)
:: Add the rest of the browser cache clearing commands below as necessary.

:: ========================================
:: 3. Clear Windows Update Cache
:: ========================================
echo Clearing Windows Update cache...
net stop wuauserv >nul 2>&1
del /s /q /f C:\Windows\SoftwareDistribution\Download\*.* >nul 2>&1
net start wuauserv >nul 2>&1

:: ========================================
:: 4. Empty Recycle Bin
:: ========================================
echo Emptying Recycle Bin...
rd /s /q %systemdrive%\$Recycle.Bin >nul 2>&1

:: ========================================
:: 5. Run Disk Cleanup Utility (Silent Mode)
:: ========================================
echo Running Disk Cleanup...
cleanmgr /sagerun:1 >nul 2>&1

:: ========================================
:: 6. Run Check Disk for Errors (chkdsk)
:: ========================================
echo Checking disk for errors...
echo You may need to restart your PC if errors are found.
chkdsk /f /r >nul 2>&1

:: ========================================
:: 7. Optimize (Defragment) Drives
:: ========================================
echo Optimizing drives...
defrag C: /O >nul 2>&1

:: ========================================
:: 8. Run System File Checker (SFC)
:: ========================================
echo Running System File Checker (SFC) to check and repair system files...
sfc /scannow

:: ========================================
:: 9. Run DISM to Check, Scan, and Restore Health of Windows Image
:: ========================================
echo Checking Windows image health using DISM...
DISM /Online /Cleanup-Image /CheckHealth

echo Scanning Windows image health...
DISM /Online /Cleanup-Image /ScanHealth

echo Restoring Windows image health if any issues found...
DISM /Online /Cleanup-Image /RestoreHealth

:: ========================================
:: 10. Restart Prompt
:: ========================================
echo =============================
echo Cleaning and optimization complete!
echo It is recommended to restart your computer now.
echo =============================
pause
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cleanup of Hard Drive 7

Top