-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCleanPC.bat
More file actions
446 lines (381 loc) · 12.7 KB
/
Copy pathCleanPC.bat
File metadata and controls
446 lines (381 loc) · 12.7 KB
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
@echo off
setlocal enabledelayedexpansion
:: === Auto-update configuration ===
set "current_version=1.0.0.9"
set "version_url=https://raw.githubusercontent.com/BlackBullNetwork/Cleaner-Script/refs/heads/main/latest_version.txt"
set "script_url=https://raw.githubusercontent.com/BlackBullNetwork/Cleaner-Script/refs/heads/main/CleanPC.bat"
set "curl_path=%SystemRoot%\System32\curl.exe"
echo Checking for updates...
:: Download latest version number
"%curl_path%" -s -o "%temp%\latest_version.txt" "%version_url%"
if errorlevel 1 (
echo Failed to download version info.
goto mainmenu
)
if not exist "%temp%\latest_version.txt" (
echo Version info file missing.
goto mainmenu
)
:: Read latest version into variable
set /p latest_version=<"%temp%\latest_version.txt"
for /f "tokens=* delims= " %%a in ("!latest_version!") do set "latest_version=%%a"
echo Current version: !current_version!
echo Latest version: !latest_version!
if "!latest_version!"=="!current_version!" (
echo You are already running the latest version.
goto mainmenu
) else (
echo New version available! Downloading update...
"%curl_path%" -s -o "%temp%\BlackBullCleaner_new.bat" "%script_url%"
if errorlevel 1 (
echo Failed to download updated script.
goto mainmenu
)
if exist "%temp%\BlackBullCleaner_new.bat" (
echo Update downloaded.
echo Copying new script over current script...
copy /Y "%temp%\BlackBullCleaner_new.bat" "%~f0" >nul
if errorlevel 1 (
echo Failed to update script file. Close any open editors or permissions may be blocking it.
goto mainmenu
)
echo Update successful! Restarting script now...
timeout /t 2 /nobreak >nul
start "" "%~f0"
exit /b
) else (
echo Update file not found after download.
goto mainmenu
)
)
:mainmenu
cls
title BlackBull PC Cleaner
color 0A
:MENU
cls
echo ======================= V!current_version!
echo BlackBull Clean-Up Menu
echo ================================
echo [0] Check for updates
echo [1] Run MRT (Malware Scan)
echo [2] Update all programs
echo [3] Clear Temp Files
echo [4] Empty Recycle Bin
echo [5] Flush DNS Cache
echo [6] Clean Windows Update Cache
echo [7] Run SFC (System File Checker)
echo [8] Run DISM (Fix Corrupted System)
echo [9] Improve FPS / Gaming Mode
echo [10] Run Disk Cleanup
echo [11] Spotify options
echo [12] Exit
echo.
set /p choice=Choose wisely:
if "%choice%"=="0" call :CHECKUPDATE & goto MENU
if "%choice%"=="1" goto MRT
if "%choice%"=="2" goto WINGET
if "%choice%"=="3" goto CLEARTEMP
if "%choice%"=="4" goto EMPTYBIN
if "%choice%"=="5" goto FLUSHDNS
if "%choice%"=="6" goto CLEANWUCACHE
if "%choice%"=="7" goto SFC
if "%choice%"=="8" goto DISM
if "%choice%"=="9" goto FPSBOOST
if "%choice%"=="10" goto DISKCLEANUP
if "%choice%"=="11" goto Spotify
if "%choice%"=="12" exit
goto MENU
:: === Update check routine ===
:CHECKUPDATE
echo Checking for updates...
:: Download latest version number
"%curl_path%" -s -o "%temp%\latest_version.txt" "%version_url%"
if errorlevel 1 (
echo Failed to download version info.
pause
goto :eof
)
if not exist "%temp%\latest_version.txt" (
echo Version info file missing.
pause
goto :eof
)
:: Read latest version into variable
set /p latest_version=<"%temp%\latest_version.txt"
for /f "tokens=* delims= " %%a in ("!latest_version!") do set "latest_version=%%a"
echo Current version: !current_version!
echo Latest version: !latest_version!
if "!latest_version!"=="!current_version!" (
echo You are already running the latest version.
pause
goto :eof
) else (
echo New version available! Downloading update...
"%curl_path%" -s -o "%temp%\BlackBullCleaner_new.bat" "%script_url%"
if errorlevel 1 (
echo Failed to download updated script.
pause
goto :eof
)
if exist "%temp%\BlackBullCleaner_new.bat" (
echo Update downloaded.
echo Copying new script over current script...
copy /Y "%temp%\BlackBullCleaner_new.bat" "%~f0" >nul
if errorlevel 1 (
echo Failed to update script file. Close any open editors or permissions may be blocking it.
pause
goto :eof
)
echo Update successful! Restarting script now...
timeout /t 3 /nobreak >nul
start "" "%~f0"
exit /b
) else (
echo Update file not found after download.
pause
goto :eof
)
)
goto :eof
:MRT
echo Running MRT...
start mrt
pause
goto MENU
:WINGET
echo Updating all apps with winget...
winget upgrade --all
pause
goto MENU
:CLEARTEMP
echo Cleaning temp files...
del /s /f /q %temp%\*
del /s /f /q C:\Windows\Temp\*
echo Temp files deleted!
pause
goto MENU
:EMPTYBIN
echo Emptying Recycle Bin...
%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "Clear-RecycleBin -Force"
pause
goto MENU
:FLUSHDNS
echo Flushing DNS cache...
ipconfig /flushdns
pause
goto MENU
:CLEANWUCACHE
echo Stopping Windows Update Service...
net stop wuauserv
net stop bits
echo Deleting SoftwareDistribution folder...
rd /s /q C:\Windows\SoftwareDistribution
echo Starting Windows Update Service...
net start wuauserv
net start bits
pause
goto MENU
:SFC
echo Running System File Checker...
sfc /scannow
pause
goto MENU
:DISM
echo Running DISM Restore Health...
DISM /Online /Cleanup-Image /RestoreHealth
pause
goto MENU
:FPSBOOST
cls
echo ================================
echo FPS Boost Menu
echo ================================
echo [1] Install FPS Boost
echo [2] Reset FPS Boost
echo [3] Disable Windows Notifications / Focus Assist
echo [4] Set High Performance Power Plan
echo [5] Disable Xbox Game Bar ^& DVR
echo [6] Reset Network (Release/Renew, Winsock reset)
echo [7] Clean GPU Cache ^& Temp Files (NVIDIA)
echo [8] Clear Clipboard
echo [9] Disable Windows Tips
echo [10] Adjust Visual Effects for Best Performance
echo [11] Reset all FPS Boost Tweaks
echo [12] Back to Main Menu
echo.
set /p fpschoice=Choose an option:
if "%fpschoice%"=="1" goto FPSINSTALL
if "%fpschoice%"=="2" goto FPSRESET
if "%fpschoice%"=="3" goto DISABLENOTIFS
if "%fpschoice%"=="4" goto HIGHPERF
if "%fpschoice%"=="5" goto DISABLEXBOX
if "%fpschoice%"=="6" goto RESETNETWORK
if "%fpschoice%"=="7" goto CLEANGPUCACHE
if "%fpschoice%"=="8" goto CLEARCLIPBOARD
if "%fpschoice%"=="9" goto DISABLETIPS
if "%fpschoice%"=="10" goto VISUALEFFECTS
if "%fpschoice%"=="11" goto FPSRESETALL
if "%fpschoice%"=="12" goto MENU
goto FPSBOOST
:FPSINSTALL
echo Applying FPS Boost tweaks...
:: Stop unnecessary services
%SystemRoot%\System32\sc.exe stop "SysMain"
%SystemRoot%\System32\sc.exe config "SysMain" start= disabled
%SystemRoot%\System32\sc.exe stop "DiagTrack"
%SystemRoot%\System32\sc.exe config "DiagTrack" start= disabled
%SystemRoot%\System32\sc.exe stop "WSearch"
%SystemRoot%\System32\sc.exe config "WSearch" start= disabled
%SystemRoot%\System32\sc.exe stop "Fax"
%SystemRoot%\System32\sc.exe config "Fax" start= disabled
:: Disable transparency effects & animations
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v EnableTransparency /t REG_DWORD /d 0 /f
:: Disable Windows Game Mode
reg add "HKCU\Software\Microsoft\GameBar" /v AllowAutoGameMode /t REG_DWORD /d 0 /f
:: Disable Microsoft Edge background processes & startup boost
reg add "HKCU\Software\Policies\Microsoft\MicrosoftEdge\Main" /v AllowPrelaunch /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Policies\Microsoft\MicrosoftEdge\TabPreloader" /v AllowTabPreloading /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v StartupBoostEnabled /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v BackgroundModeEnabled /t REG_DWORD /d 0 /f
echo FPS boost applied! Some changes require restart.
pause
goto FPSBOOST
:FPSRESET
echo Reverting FPS Boost tweaks...
:: Re-enable services
%SystemRoot%\System32\sc.exe config "SysMain" start= auto
%SystemRoot%\System32\sc.exe start "SysMain"
%SystemRoot%\System32\sc.exe config "DiagTrack" start= auto
%SystemRoot%\System32\sc.exe start "DiagTrack"
%SystemRoot%\System32\sc.exe config "WSearch" start= delayed-auto
%SystemRoot%\System32\sc.exe start "WSearch"
%SystemRoot%\System32\sc.exe config "Fax" start= demand
:: Re-enable transparency effects & animations
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v EnableTransparency /t REG_DWORD /d 1 /f
:: Re-enable Windows Game Mode
reg add "HKCU\Software\Microsoft\GameBar" /v AllowAutoGameMode /t REG_DWORD /d 1 /f
:: Remove Edge restrictions
reg delete "HKCU\Software\Policies\Microsoft\MicrosoftEdge" /f
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Edge" /f
echo FPS boost reverted! Some changes require restart.
pause
goto FPSBOOST
:DISABLENOTIFS
echo Disabling Windows Notifications and Focus Assist...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings" /v NOC_GLOBAL_SETTING_TOASTS_ENABLED /t REG_DWORD /d 0 /f
echo Notifications disabled.
pause
goto FPSBOOST
:HIGHPERF
echo Setting High Performance Power Plan...
powercfg /setactive SCHEME_MIN
echo High Performance power plan set.
pause
goto FPSBOOST
:DISABLEXBOX
echo Disabling Xbox Game Bar and Game DVR...
reg add "HKCU\Software\Microsoft\GameBar" /v AllowAutoGameMode /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\GameBar" /v GameDVR_Enabled /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\GameBar" /v GameDVR_FSEBehaviorMode /t REG_DWORD /d 0 /f
%SystemRoot%\System32\sc.exe stop "XblGameSave"
%SystemRoot%\System32\sc.exe config "XblGameSave" start= disabled
%SystemRoot%\System32\sc.exe stop "XboxGipSvc"
%SystemRoot%\System32\sc.exe config "XboxGipSvc" start= disabled
echo Xbox Game Bar and DVR disabled.
pause
goto FPSBOOST
:RESETNETWORK
echo Resetting Network (release/renew IP, winsock, IP reset)...
ipconfig /release
ipconfig /renew
netsh winsock reset
netsh int ip reset
echo Network reset complete. Restart recommended.
pause
goto FPSBOOST
:CLEANGPUCACHE
echo Cleaning NVIDIA GPU cache and temp files...
del /s /q "%LOCALAPPDATA%\NVIDIA\GLCache\*" >nul 2>&1
del /s /q "%LOCALAPPDATA%\NVIDIA\DXCache\*" >nul 2>&1
echo GPU cache cleaned.
pause
goto FPSBOOST
:CLEARCLIPBOARD
echo Clearing Clipboard...
echo off | clip
echo Clipboard cleared.
pause
goto FPSBOOST
:DISABLETIPS
echo Disabling Windows Tips...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v SystemPaneSuggestionsEnabled /t REG_DWORD /d 0 /f
echo Windows Tips disabled.
pause
goto FPSBOOST
:VISUALEFFECTS
echo Adjusting Visual Effects for best performance...
reg add "HKCU\Control Panel\Desktop\WindowMetrics" /v MinAnimate /t REG_SZ /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /v VisualFXSetting /t REG_DWORD /d 2 /f
echo Visual effects adjusted.
pause
goto FPSBOOST
:FPSRESETALL
echo Resetting all FPS Boost tweaks to original settings...
:: Call the same commands as FPSRESET to revert services and registry tweaks
goto FPSRESET
:: DISKCLEANUP option
:DISKCLEANUP
echo Running Disk Cleanup with predefined settings...
%SystemRoot%\System32\cleanmgr.exe /sagerun:1
goto MENU
:Spotify
cls
echo ================================
echo Spotify Options
echo Listen without any ads!
echo ================================
echo [1] Install Spotify adblocker
echo [2] Uninstall Spotify adblocker
echo [3] Back to Main Menu
echo.
set /p spotifychoice=Choose an option:
if "%spotifychoice%"=="1" goto SPOTIFY_INSTALL
if "%spotifychoice%"=="2" goto SPOTIFY_UNINSTALL
if "%spotifychoice%"=="3" goto MENU
goto Spotify
:SPOTIFY_INSTALL
cls
echo Installing Spotify...
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = 3072}; """"& { $(Invoke-WebRequest -UseBasicParsing 'https://spotx-official.github.io/run.ps1')} -new_theme """" | Invoke-Expression"
pause
goto Spotify
:SPOTIFY_UNINSTALL
cls
echo Uninstalling Spotify...
SETLOCAL ENABLEDELAYEDEXPANSION
if exist "%Appdata%\Spotify\dpapi.dll" (
del /s /q "%Appdata%\Spotify\dpapi.dll" > NUL 2>&1
)
if exist "%Appdata%\Spotify\Spotify.bak" (
del /s /q "%Appdata%\Spotify.exe" > NUL 2>&1
move "%Appdata%\Spotify\Spotify.bak" "%Appdata%\Spotify\Spotify.exe" > NUL 2>&1
)
if exist "%Appdata%\Spotify\config.ini" (
del /s /q "%Appdata%\Spotify\config.ini" > NUL 2>&1
)
if exist "%Appdata%\Spotify\Apps\xpui.bak" (
del /s /q "%Appdata%\Spotify\Apps\xpui.spa" > NUL 2>&1
move "%Appdata%\Spotify\Apps\xpui.bak" "%Appdata%\Spotify\Apps\xpui.spa" > NUL 2>&1
)
if exist "%Appdata%\Spotify\blockthespot_log.txt" (
del /s /q "%Appdata%\Spotify\blockthespot_log.txt" > NUL 2>&1
)
if exist "%temp%\SpotX_Temp*" (
for /d %%i in ("%temp%\SpotX_Temp*") do (
rd /s/q "%%i" > NUL 2>&1
)
)
echo Successfully removed.
pause
goto Spotify