Skip to content

Commit 30879d8

Browse files
authored
Add files via upload
1 parent b89407b commit 30879d8

File tree

1 file changed

+189
-0
lines changed

1 file changed

+189
-0
lines changed

WindowsCleanerUtility.bat

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
@echo off
2+
mode con cols=122 lines=40
3+
chcp 65001
4+
cls
5+
6+
REM --> Check for permissions
7+
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
8+
9+
REM --> If error flag set, we do not have admin.
10+
if '%errorlevel%' NEQ '0' (
11+
echo Requesting administrative privileges...
12+
goto UACPrompt
13+
) else ( goto gotAdmin )
14+
15+
:UACPrompt
16+
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
17+
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
18+
19+
"%temp%\getadmin.vbs"
20+
exit /B
21+
22+
:gotAdmin
23+
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
24+
pushd "%CD%"
25+
CD /D "%~dp0"
26+
27+
echo [%date% %time%] Windows Cleaner Utility Launcher by Chainski Tools >> WindowsCleanerUtility-Log.txt
28+
echo [%date% %time%] Launching Windows Cleaner Utility... >> WindowsCleanerUtility-Log.txt
29+
echo Windows Cleaner Utility Launcher by Chainski Tools
30+
goto int
31+
32+
:int
33+
echo Loading configuration, please wait ...
34+
cls
35+
echo [%date% %time%] Loading configuration... >> WindowsCleanerUtility-Log.txt
36+
set VER=1.0.0
37+
echo [%date% %time%] Value Loaded: VER = %ver% >> WindowsCleanerUtility-Log.txt
38+
set dir=%temp%
39+
40+
set github-link=https://github.com/Chainski/WindowsCleanerUtility
41+
echo [%date% %time%] Value Loaded: github-link = %github-link% >> WindowsCleanerUtility-Log.txt
42+
set license=GNU GENERAL PUBLIC LICENSE (version 3)
43+
echo [%date% %time%] Value Loaded: license = %license% >> WindowsCleanerUtility-Log.txt
44+
set license-file=LICENSE.txt
45+
echo [%date% %time%] Value Loaded: license-file = %license-file% >> WindowsCleanerUtility-Log.txt
46+
echo [%date% %time%] Windows Cleaner Utility Version Loaded: %ver% >> WindowsCleanerUtility-Log.txt
47+
timeout 1 /nul
48+
goto menu
49+
50+
:menu
51+
cls
52+
53+
echo  ╔╗╔╗╔╗╔══╗╔═╗ ╔╗╔═══╗╔═══╗╔╗╔╗╔╗╔═══╗  ╔═══╗╔╗ ╔═══╗╔═══╗╔═╗ ╔╗╔═══╗╔═══╗  ╔╗ ╔╗╔════╗╔══╗╔╗ ╔══╗╔════╗╔╗ ╔╗
54+
echo  ║║║║║║╚╣╠╝║║╚╗║║╚╗╔╗║║╔═╗║║║║║║║║╔═╗║  ║╔═╗║║║ ║╔══╝║╔═╗║║║╚╗║║║╔══╝║╔═╗║  ║║ ║║║╔╗╔╗║╚╣╠╝║║ ╚╣╠╝║╔╗╔╗║║╚╗╔╝║
55+
echo  ║║║║║║ ║║ ║╔╗╚╝║ ║║║║║║ ║║║║║║║║║╚══╗  ║║ ╚╝║║ ║╚══╗║║ ║║║╔╗╚╝║║╚══╗║╚═╝║  ║║ ║║╚╝║║╚╝ ║║ ║║ ║║ ╚╝║║╚╝╚╗╚╝╔╝
56+
echo  ║╚╝╚╝║ ║║ ║║╚╗║║ ║║║║║║ ║║║╚╝╚╝║╚══╗║  ║║ ╔╗║║ ╔╗║╔══╝║╚═╝║║║╚╗║║║╔══╝║╔╗╔╝  ║║ ║║ ║║ ║║ ║║ ╔╗ ║║ ║║ ╚╗╔╝
57+
echo  ╚╗╔╗╔╝╔╣╠╗║║ ║║║╔╝╚╝║║╚═╝║╚╗╔╗╔╝║╚═╝║  ║╚═╝║║╚═╝║║╚══╗║╔═╗║║║ ║║║║╚══╗║║║╚╗  ║╚═╝║ ╔╝╚╗ ╔╣╠╗║╚═╝║╔╣╠╗ ╔╝╚╗ ║║
58+
echo  ╚╝╚╝ ╚══╝╚╝ ╚═╝╚═══╝╚═══╝ ╚╝╚╝ ╚═══╝  ╚═══╝╚═══╝╚═══╝╚╝ ╚╝╚╝ ╚═╝╚═══╝╚╝╚═╝  ╚═══╝ ╚══╝ ╚══╝╚═══╝╚══╝ ╚══╝ ╚╝
59+
echo.
60+
echo.
61+
echo  ╔════════════════════════════════╗
62+
echo  ║ Windows Cleaner Utility ║
63+
echo  ║ coded by Chainski Tools ║
64+
echo  ╚════════════════════════════════╝
65+
66+
echo [%date% %time%] Windows Cleaner Utility succesfully launched >> WindowsCleanerUtility-Log.txt
67+
title Windows Cleaner Utility %ver% by Chainski Tools
68+
echo.
69+
echo  Press a button from 1 to 4 - each of these buttons has its own function as described below:
70+
echo.
71+
echo 1 - Delete the Temporary Files
72+
echo.
73+
echo 2 - Program and license information
74+
echo 3 - Page on GitHub
75+
echo.
76+
echo 4 - End session (will close the program)
77+
choice /c 1234 /n
78+
if %errorlevel%==1 goto clear-init
79+
if %errorlevel%==2 goto info
80+
if %errorlevel%==3 goto github
81+
if %errorlevel%==4 goto End
82+
83+
:END
84+
cls
85+
echo [%date% %time%] Session Ended >> WindowsCleanerUtility-Log.txt
86+
exit
87+
88+
:clear-init
89+
echo [%date% %time%] Preparing... >> WindowsCleanerUtility-Log.txt
90+
cls
91+
echo Checking Temporary Files...
92+
cd %temp%
93+
if exist * goto clear-warning
94+
if not exist * goto good-to-go
95+
96+
:clear-warning
97+
echo [%date% %time%] PC needs deep cleaning >> WindowsCleanerUtility-Log.txt
98+
cls
99+
echo.
100+
echo Your PC needs deep cleaning! Check the list above and select the appropriate action.
101+
echo Press 1 to clear data and reclaim disk space.
102+
echo Press 2 to stop the current operations and exit the program.
103+
choice /c 12 /n
104+
if %errorlevel%==1 goto clear
105+
if %errorlevel%==2 exit
106+
107+
:clear
108+
109+
rem Delete Temporary Files
110+
echo [%date% %time%] Cleaning... >> WindowsCleanerUtility-Log.txt
111+
cleanmgr.exe /autoclean :: Used to delete old files left after upgrading a Windows build
112+
del /s /f /q %windir%\temp\*.*
113+
del /s /f /q %temp%\*.*
114+
del /s /f /q %windir%\Prefetch\*.*
115+
del /s /f /q %LOCALAPPDATA%\Microsoft\Windows\Caches\*.*
116+
del /s /f /q %windir%\SoftwareDistribution\Download\*.*
117+
del /s /f /q %programdata%\Microsoft\Windows\WER\Temp\*.*
118+
del /s /f /q %HomePath%\AppData\LocalLow\Temp\*.*
119+
rd /s /f /q %windir%\history 2>nul >nul
120+
rd /s /f /q %windir%\cookies 2>nul >nul
121+
cls
122+
123+
REM Delete Log Files
124+
del /s /f /q %windir%\Logs\CBS\CbsPersist*.log
125+
del /s /f /q %windir%\Logs\MoSetup\*.log
126+
del /s /f /q %windir%\Panther\*.log
127+
del /s /f /q %windir%\logs\*.log
128+
del /s /f /q %localappdata%\Microsoft\Windows\WebCache\*.log
129+
rd /s /f /q %localappdata%\Microsoft\Windows\INetCache\*.log
130+
cls
131+
132+
rem Delete Remnant Drivers Files (Not needed because already installed)
133+
del /s /f /q %SYSTEMDRIVE%\AMD\*.*
134+
del /s /f /q %SYSTEMDRIVE%\NVIDIA\*.*
135+
del /s /f /q %SYSTEMDRIVE%\INTEL\*.*
136+
cls
137+
138+
REM Delete Browser Cache
139+
del /s /f /q "%USERPROFILE%\AppData\Local\Microsoft\Edge\User Data\Default\Cache"
140+
141+
REM Clean DNS Resolver Cache (Restart May Be Required)
142+
ipconfig /flushdns
143+
cls
144+
netsh winsock reset all
145+
cls
146+
147+
:clear-error
148+
echo Unfortunately, we were unable to remove all of the Temporary files (some are being used by other processes).
149+
echo You can manually open the Temporary Folders and try to delete the remaining files.
150+
echo.
151+
echo Press 1 to try again.
152+
echo Press 2 to return to the menu.
153+
choice /c 12 /n
154+
if %errorlevel%==1 goto clear
155+
if %errorlevel%==2 goto menu
156+
157+
echo Reclaiming disk space, please wait (this process may take some time) ...
158+
if exist * goto clear-error
159+
if not exist * goto clear-complete
160+
161+
:clear-complete
162+
echo [%date% %time%] Requested operations completed. >> WindowsCleanerUtility-Log.txt
163+
cls
164+
echo Ready! Your computer has been cleared of unnecessary temporary data!
165+
pause
166+
goto menu
167+
168+
:good-to-go
169+
echo [%date% %time%] Requested operations completed. >> WindowsCleanerUtility-Log.txt
170+
cls
171+
echo Your PC doesn't need cleaning. Your PC is good to go!
172+
pause
173+
goto menu
174+
175+
:info
176+
cls
177+
echo Windows Cleaner Utility
178+
echo %ver% by Chainski
179+
echo.
180+
echo Source code avaible on GitHub: %github-link%
181+
echo Working under license: %license%
182+
echo.
183+
pause /nul
184+
goto menu
185+
186+
:github
187+
cls
188+
start %github-link%
189+
goto menu

0 commit comments

Comments
 (0)