-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathwrn-cleaner-4.5.0.bat
452 lines (431 loc) · 11.5 KB
/
wrn-cleaner-4.5.0.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
REM =============================
REM WRN Cleaner - https://github.com/warengonzaga/wrn-cleaner
REM A maintenance tool that can automatically or manually clean up your Windows machine in a simple and reliable way.
REM Version: 4.5.0
REM Github: https://github.com/warengonzaga/wrn-cleaner
REM Licensed under GNU General Public License v3: https://opensource.org/licenses/GPL-3.0
REM Copyright (c) 2022 Waren Gonzaga
REM
REM Twitter: @warengonzaga
REM Github: @warengonzaga
REM Website: warengonzaga.com
REM
REM Donate or Support!
REM https://warengonzaga.com/donate
REM =============================
cls
@echo off
REM =============================
REM Setup Variables
REM =============================
set appname=WRN
set appvers=4.5.0
set appstat=Stable
set dev=Waren Gonzaga
set desc=A maintenance tool that can automatically or manually clean up your Windows machine in a simple and reliable way.
set uicolor=a
set infouicolor=b
set erruicolor=c
set cliN=%appname%Cleaner$
set divider======================================
title %appname% PC Cleaner %appvers% - %appstat%
@echo off
color %infouicolor%
echo Administrative permissions required. Detecting permissions.
ping localhost -n 2 >NUL
cls
echo Administrative permissions required. Detecting permissions..
ping localhost -n 2 >NUL
cls
echo Administrative permissions required. Detecting permissions...
ping localhost -n 2 >NUL
net session >nul 2>&1
if %errorLevel% == 0 (
echo Administrator privileges found!
echo Starting the program...
ping localhost -n 2 >NUL
goto mainMenu
) else (
cls
color %erruicolor%
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo #
echo # ERROR * ERROR * ERROR * ERROR * ERROR * ERROR
echo #
echo # Current user permissions to execute this .bat file are inadequate.
echo # This .bat file must be run with administrative privileges.
echo # Close this program and run it as administrator.
echo # Contact the developer to assist you...
echo #
echo # ERROR * ERROR * ERROR * ERROR * ERROR * ERROR
echo #
pause
exit
)
REM =============================
REM Main Menu
REM =============================
:mainMenu
cls
title %appname% PC Cleaner %appvers% - %appstat% [Main Menu]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
color %uicolor%
echo # %desc%
echo # %divider%
echo # Please choose cleaning method!
echo #
echo # Auto ....................... [1] (default)
echo # Manual ..................... [?] (soon)
echo # Exit ....................... [2]
echo #
set/p "mainMenu=# %cliN%> " || set mainMenu=1
if %mainMenu%==1 set clean_method=Auto & goto autoInit
if %addOption%==2 goto exitProgram
pause>null
goto errMes01
REM if %mainMenu%==manual goto mnlModeMenu
REM if %mainMenu%==dev goto devModeMenu
REM =============================
REM Initial Setup Screen
REM =============================
:autoInit
cls
title %appname% PC Cleaner %appvers% - %appstat% [Initial Setup]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
color %infouicolor%
echo # Please choose action after cleaning!
echo #
echo # Auto Shutdown .............. [1]
echo # Auto Reboot ................ [2]
echo # Manual Shutdown/Reboot ..... [3]
echo # Back to Main Menu .......... [4] (default)
echo #
set/p "autoInitVar=# %cliN%> " || set autoInitVar=4
if %autoInitVar%==1 set clean_action=Auto Shutdown & goto auto
if %autoInitVar%==2 set clean_action=Auto Reboot & goto auto
if %autoInitVar%==3 set clean_action=Manual Shutdown/Reboot & goto auto
if %autoInitVar%==4 goto mainMenu
pause>null
goto errMes02
REM =============================
REM Automatic Functions
REM =============================
:auto
cls
title %appname% PC Cleaner %appvers% - %appstat% [Processing]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%]
echo # %divider%
color %uicolor%
echo # Running...
echo #
ping localhost -n 2 >NUL
goto aDiskClean
REM =============================
REM Automatic DiskClean Function
REM =============================
:aDiskClean
cls
title %appname% PC Cleaner %appvers% - %appstat% [DiskClean]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%] [Disk Cleanup]
echo # %divider%
echo # Running...
echo #
ping localhost -n 2 >NUL
cleanmgr /d%driveClean%
timeout /t 3 /nobreak> null
goto aDefrag
REM =============================
REM Automatic Defragment Function
REM =============================
:aDefrag
cls
title %appname% PC Cleaner %appvers% - %appstat% [Defragment]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%] [Defragment]
echo # %divider%
echo # Running...
echo #
ping localhost -n 2 >NUL
defrag /c /o /u /v /h
timeout /t 3 /nobreak> null
goto aSystemFileChecker
REM =============================
REM Automatic System File Checker
REM =============================
:aSystemFileChecker
cls
title %appname% PC Cleaner %appvers% - %appstat% [System File Checker]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%] [Scanning PC]
echo # %divider%
echo # Running...
ping localhost -n 2 >NUL
sfc /scannow
goto aRecyleBin
REM =============================
REM Automatic Empty Recyle Bin
REM =============================
:aRecyleBin
cls
title %appname% PC Cleaner %appvers% - %appstat% [Cleaning Recycle Bin]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%] [Recycle Bin]
echo # %divider%
echo # Running...
echo #
ping localhost -n 2 >NUL
echo y | rd /s %systemdrive%\$Recycle.bin
timeout /t 3 /nobreak> null
goto aTempClean
REM =============================
REM Automatic Empty Temp Function
REM =============================
:aTempClean
cls
title %appname% PC Cleaner %appvers% - %appstat% [Cleaning Temp]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%] [Temp Folder]
echo # %divider%
echo # Running...
echo #
ping localhost -n 2 >NUL
del %temp%\*.*/s/q
@ping 127.0.0.1 -n 2 -w 100 > nul
@ping 127.0.0.1 -n %1% -w 100 > nul
timeout /t 3 /nobreak> null
goto aPrefetch
REM =============================
REM Automatic Empty Prefetch Function
REM =============================
:aPrefetch
cls
title %appname% PC Cleaner %appvers% - %appstat% [Cleaning Prefetch]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%] [Prefetch Folder]
echo # %divider%
echo # Running...
echo #
ping localhost -n 2 >NUL
del C:\Windows\prefetch\*.*/s/q
@ping 127.0.0.1 -n 2 -w 100 > nul
@ping 127.0.0.1 -n %1% -w 100 > nul
timeout /t 3 /nobreak> null
goto aWindowsLogs
REM =============================
REM Automatic Cleaning the Windows Logs
REM =============================
:aWindowsLogs
cls
title %appname% PC Cleaner %appvers% - %appstat% [Cleaning Windows Logs]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
echo # [%clean_method%- %clean_action%] [Windows Logs]
echo # %divider%
echo # Running...
echo #
ping localhost -n 2 >NUL
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :aWindowsLogs_cleaner "%%G")
goto autoOption
REM =============================
REM Cleaner of Windows Logs
REM =============================
:aWindowsLogs_cleaner
echo clearing %1
wevtutil.exe cl %1
goto :eof
goto autoOption
REM =============================
REM Automated Option Screen
REM =============================
:autoOption
title %appname% PC Cleaner %appvers% - %appstat% [AI]
if %autoInitVar%==1 goto shutdownOption
if %autoInitVar%==2 goto rebootOption
if %autoInitVar%==3 goto addOption
REM =============================
REM Additional Option Screen
REM =============================
:addOption
cls
title %appname% PC Cleaner %appvers% - %appstat% [Additional Option]
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo # The cleaning is almost complete!
echo # What would you like to do?
echo #
echo # Shutdown ................... [1]
echo # Reboot ..................... [2]
echo # Back to Main Menu .......... [3] (default)
echo # Exit ....................... [4]
echo #
set/p "addOption=# %cliN%> " || set addOption=3
if %addOption%==1 goto shutdownOption
if %addOption%==2 goto rebootOption
if %addOption%==3 goto doneCleaning
if %addOption%==4 goto exitProgram
goto doneCleaning
REM =============================
REM Shutdown Option
REM =============================
:shutdownOption
cls
title %appname% PC Cleaner %appvers% - %appstat% [Shutting Down]
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo #
echo # Shutting Down.
cls
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo #
echo # Shutting Down..
ping localhost -n 2 >NUL
cls
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo #
echo # Shutting Down...
ping localhost -n 2 >NUL
shutdown -s -t 10 -c "PC Will Shutdown in 5 seconds..."
timeout 10
goto exitProgram
REM =============================
REM Reboot Option
REM =============================
:rebootOption
cls
title %appname% PC Cleaner %appvers% - %appstat% [Rebooting]
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo #
echo # Rebooting.
cls
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo #
echo # Rebooting..
ping localhost -n 2 >NUL
cls
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo #
echo # Rebooting...
ping localhost -n 2 >NUL
shutdown -r -t 10 -c "PC Will Reboot in 5 seconds..."
timeout 10
goto exitProgram
REM =============================
REM Successful Cleaning Screen
REM =============================
:doneCleaning
cls
title %appname% PC Cleaner %appvers% - %appstat% [Successful Cleaning]
echo # %divider%
echo # %appname% PC Cleaner %appvers%
echo # by %dev%
echo # %divider%
color %uicolor%
echo #
echo # Done Auto Cleaning...
timeout /t 2 /nobreak> null
goto mainMenu
REM =============================
REM Error 1 Message Screen
REM =============================
:errMes01
cls
title %appname% PC Cleaner %appvers% - %appstat% [ERROR]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
color %erruicolor%
echo #
echo # ERROR * ERROR * ERROR * ERROR * ERROR * ERROR
echo #
echo # You input an invalid entry please use the specified options.
echo #
echo # ERROR * ERROR * ERROR * ERROR * ERROR * ERROR
echo #
pause>null
goto mainMenu
REM =============================
REM Error 2 Message Screen
REM =============================
:errMes02
cls
title %appname% PC Cleaner %appvers% - %appstat% [ERROR]
echo # %divider%
echo # %appname% PC Cleaner %appvers% - %appstat%
echo # by %dev%
echo # %divider%
color %erruicolor%
echo #
echo # ERROR * ERROR * ERROR * ERROR * ERROR * ERROR
echo #
echo # You input an invalid entry please use the specified options.
echo #
echo # ERROR * ERROR * ERROR * ERROR * ERROR * ERROR
echo #
pause>null
goto autoInit
REM =============================
REM Exit Option Function
REM =============================
:exitProgram
exit