-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUltimateWindowsOptimizer.bat
More file actions
406 lines (366 loc) · 23 KB
/
Copy pathUltimateWindowsOptimizer.bat
File metadata and controls
406 lines (366 loc) · 23 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
@echo off
setlocal EnableDelayedExpansion
title Optimizador de Windows 11 v6.0 - Optimización Integral Segura
cls
:: ====================================================================
:: CONFIGURACIÓN INICIAL: GENERAR CARÁCTER DE RETORNO DE CARRO (CR)
:: Para que la barra de progreso se redibuje en la misma línea
:: ====================================================================
powershell -NoProfile -Command "[IO.File]::WriteAllText('%temp%\cr.txt', \"`r.\")"
set /p "CR="<"%temp%\cr.txt"
set "CR=!CR:~0,-1!"
del "%temp%\cr.txt" >nul 2>&1
echo ==============================
echo Iniciando optimización de Windows 11...
echo ==============================
timeout /t 3 >nul
echo ==============================================================
echo 01. CREANDO PUNTO DE RESTAURACION DEL SISTEMA
echo ==============================================================
echo Creando punto de restauracion antes de realizar los cambios...
powershell -Command "Enable-ComputerRestore -Drive 'C:\\'; Checkpoint-Computer -Description 'Antes de optimizacion Windows 11' -RestorePointType MODIFY_SETTINGS"
if %errorlevel% equ 0 (
echo Punto de restauracion creado exitosamente.
) else (
echo ADVERTENCIA: No se pudo crear el punto de restauracion.
echo Te recomendamos crear uno manualmente antes de continuar.
)
set "BACKUP_PATH=%USERPROFILE%\Desktop\Backup_Registro"
mkdir "%BACKUP_PATH%" >nul 2>&1
echo Creando respaldo del registro en el Escritorio...
reg export HKEY_CLASSES_ROOT "%BACKUP_PATH%\1_HKCR.reg" /y >nul 2>&1
reg export HKEY_CURRENT_USER "%BACKUP_PATH%\2_HKCU.reg" /y >nul 2>&1
reg export HKEY_LOCAL_MACHINE "%BACKUP_PATH%\3_HKLM.reg" /y >nul 2>&1
reg export HKEY_USERS "%BACKUP_PATH%\4_HKU.reg" /y >nul 2>&1
reg export HKEY_CURRENT_CONFIG "%BACKUP_PATH%\5_HKCC.reg" /y >nul 2>&1
timeout /t 2 >nul
call :UpdateProgress 1
echo.
echo ==============================================================
echo 02. DESACTIVAR BITLOCKER
echo ==============================================================
manage-bde -off C: >nul 2>&1
echo BitLocker desactivando. El proceso continuara en segundo plano.
timeout /t 2 >nul
call :UpdateProgress 2
echo.
echo ==============================================================
echo 03. DEFENDER (MODO SEGURO - SIN TOCAR ARCHIVOS DEL SISTEMA)
echo ==============================================================
echo [+] Deshabilitando servicios via registro (Start=4)...
set "base=HKLM\SYSTEM\CurrentControlSet\Services"
for %%s in (WinDefend WdFilters WdBoot WdNisDrv WdNisSvc Sense SecurityHealthService wscsvc) do (
reg add "%base%\%%s" /v "Start" /t REG_DWORD /d 4 /f >nul 2>&1
)
echo [+] Aplicando politicas de grupo...
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d 1 /f >nul 2>&1
echo [+] Eliminando tareas programadas de Defender...
schtasks /delete /tn "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /f >nul 2>&1
schtasks /delete /tn "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /f >nul 2>&1
schtasks /delete /tn "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /f >nul 2>&1
echo [OK] Defender deshabilitado sin eliminar componentes XAML.
timeout /t 2 >nul
call :UpdateProgress 3
echo.
echo ==============================================================
echo 04. ELIMINANDO BLOATWARE (SEGURO)
echo ==============================================================
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v AutoDownload /t REG_DWORD /d 2 /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v DisableStoreApps /t REG_DWORD /d 1 /f >nul 2>&1
echo [+] Desinstalando apps preinstaladas...
powershell -NoProfile -Command "$apps=@('3DBuilder','ZuneMusic','ZuneVideo','XboxApp','XboxGameOverlay','Xbox.TCUI','BingNews','GetHelp','Getstarted','MicrosoftSolitaireCollection','People','SkypeApp','MicrosoftOfficeHub','Todos','WindowsAlarms','WindowsFeedbackHub','WindowsMaps','WindowsSoundRecorder','YourPhone','StickyNotes','MicrosoftStickyNotes','OneConnect','Wallet','GamingApp','XboxIdentityProvider','WindowsPhotos','WindowsCamera','WindowsCommunicationsApps','WindowsTerminal','PowerAutomateDesktop','OutlookForWindows'); foreach($a in $apps){Get-AppxPackage -AllUsers *$a*|Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue; Get-AppxProvisionedPackage -Online|Where-Object{$_.DisplayName -like '*$a*'}|Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue}" >nul 2>&1
echo [+] Limpiando apps OEM...
powershell -NoProfile -Command "$v='hp|lenovo|dell|asus|acer'; $e='driver|firmware|bios|interface|foundation|system|hotkey|audio|chipset|service'; Get-AppxPackage -AllUsers|Where-Object{($_.Name-match $v)-or($_.PackageFamilyName-match $v)}|Where-Object{$_.Name-notmatch $e}|ForEach-Object{Remove-AppxPackage -Package $_.PackageFullName -AllUsers -ErrorAction SilentlyContinue}; Get-AppxProvisionedPackage -Online|Where-Object{$_.DisplayName-match $v}|Where-Object{$_.DisplayName-notmatch $e}|ForEach-Object{Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName -ErrorAction SilentlyContinue}" >nul 2>&1
echo [OK] Bloatware eliminado.
timeout /t 2 >nul
call :UpdateProgress 4
echo.
echo ==============================================================
echo 05. DESACTIVAR WIDGETS Y XBOX
echo ==============================================================
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarDa /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f >nul 2>&1
powershell -Command "Get-AppxPackage -AllUsers *WindowsWebExperiencePack* | Remove-AppxPackage -ErrorAction SilentlyContinue" >nul 2>&1
dism /online /get-provisionedappxpackages | findstr "XboxGamingOverlay" >nul && dism /online /remove-provisionedappxpackage /packagename:Microsoft.XboxGamingOverlay_* >nul 2>&1
dism /online /get-provisionedappxpackages | findstr "XboxGameCallableUI" >nul && dism /online /remove-provisionedappxpackage /packagename:Microsoft.XboxGameCallableUI_* >nul 2>&1
powershell -Command "Get-AppxPackage *Xbox* | Remove-AppxPackage -ErrorAction SilentlyContinue" >nul 2>&1
echo [OK] Widgets y Xbox desactivados.
timeout /t 2 >nul
call :UpdateProgress 5
echo.
echo ==============================================================
echo 06. LIMPIAR INICIO AUTOMÁTICO
echo ==============================================================
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f >nul 2>&1
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f >nul 2>&1
if exist "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup" del /q "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\*" >nul 2>&1
if exist "%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Startup" del /q "%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Startup\*" >nul 2>&1
timeout /t 2 >nul
call :UpdateProgress 6
echo.
echo ==============================================================
echo 07. MEMORIA RAM / PAGEFILE
echo ==============================================================
for /f %%A in ('powershell -NoProfile -Command "[math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory/1MB)"') do set RAM_MB=%%A
if "%RAM_MB%"=="" goto SKIP_PAGEFILE
set /a MIN_SIZE=RAM_MB*3/2
set /a MAX_SIZE=RAM_MB*3
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v AutomaticManagedPagefile /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "C:\pagefile.sys %MIN_SIZE% %MAX_SIZE%" /f >nul 2>&1
echo [OK] Pagefile configurado: %MIN_SIZE%MB - %MAX_SIZE%MB
:SKIP_PAGEFILE
timeout /t 2 >nul
call :UpdateProgress 7
echo.
echo ==============================================================
echo 08. OPTIMIZAR ARRANQUE
echo ==============================================================
bcdedit /set {current} numproc %NUMBER_OF_PROCESSORS% >nul 2>&1
bcdedit /set {current} useplatformclock false >nul 2>&1
bcdedit /set {current} disabledynamictick yes >nul 2>&1
echo [OK] Arranque optimizado.
timeout /t 2 >nul
call :UpdateProgress 8
echo.
echo ==============================================================
echo 09. PLAN DE ENERGÍA ULTIMATE PERFORMANCE
echo ==============================================================
reg add "HKCU\System\GameConfigStore" /v "GameModeEnabled" /t REG_DWORD /d 1 /f >nul 2>&1
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 >nul 2>&1
for /f "tokens=4" %%a in ('powercfg /list ^| findstr "e9a42b02-d5df-448d-aa00-03f14749eb61"') do set PLAN_GUID=%%a
if defined PLAN_GUID (
powercfg -setactive %PLAN_GUID%
) else (
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
)
echo [OK] Plan de máximo rendimiento activado.
timeout /t 2 >nul
call :UpdateProgress 9
echo.
echo ==============================================================
echo 10. HIBERNACIÓN ACTIVADA
echo ==============================================================
powercfg.exe /hibernate on >nul 2>&1
powercfg.exe /change standby-timeout-ac 0 >nul 2>&1
powercfg.exe /change standby-timeout-dc 0 >nul 2>&1
echo [OK] Hibernación activada. Suspensión desactivada.
timeout /t 2 >nul
call :UpdateProgress 10
echo.
echo ==============================================================
echo 11. BLOQUEAR TELEMETRÍA Y PRIVACIDAD
echo ==============================================================
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v "AllowCortana" /t REG_DWORD /d 0 /f >nul 2>&1
for %%s in (DiagTrack dmwappushservice WdiServiceHost PcaSvc WerSvc) do (sc stop %%s >nul 2>&1 & sc config %%s start= disabled >nul 2>&1)
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /t REG_SZ /d "Deny" /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone" /v "Value" /t REG_SZ /d "Deny" /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\camera" /v "Value" /t REG_SZ /d "Deny" /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\PushNotifications" /v "ToastEnabled" /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "DisableNotificationCenter" /t REG_DWORD /d 1 /f >nul 2>&1
for %%v in (SubscribedContent-310093Enabled SubscribedContent-338393Enabled SubscribedContent-353694Enabled SubscribedContent-353696Enabled SoftLandingEnabled FeatureManagementEnabled SilentInstalledAppsEnabled) do (reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "%%v" /t REG_DWORD /d 0 /f >nul 2>&1)
echo [OK] Telemetría y privacidad bloqueadas.
timeout /t 2 >nul
call :UpdateProgress 11
echo.
echo ==============================================================
echo 12. DESACTIVAR INDEXACIÓN (WSEARCH)
echo ==============================================================
sc stop "WSearch" >nul 2>&1
sc config "WSearch" start= disabled >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Services\WSearch" /v "Start" /t REG_DWORD /d 4 /f >nul 2>&1
echo [OK] Indexación desactivada.
timeout /t 2 >nul
call :UpdateProgress 12
echo.
echo ==============================================================
echo 13. OPTIMIZACIÓN DE SERVICIOS Y LIMPIEZA
echo ==============================================================
del /q /s /f "%temp%\*" >nul 2>&1
del /q /s /f "C:\Windows\Temp\*" >nul 2>&1
DISM /Online /Cleanup-Image /StartComponentCleanup /NoRestart >nul 2>&1
sc config "SysMain" start= disabled >nul 2>&1 & sc stop "SysMain" >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" /v "GlobalUserDisabled" /t REG_DWORD /d 1 /f >nul 2>&1
taskkill /f /im OneDrive.exe >nul 2>&1
reg add "HKLM\Software\Policies\Microsoft\Windows\OneDrive" /v "DisableFileSync" /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\StorageSense" /v "DisableStorageSense" /t REG_DWORD /d 1 /f >nul 2>&1
for %%s in (XblAuthManager XblGameSave XboxNetApiSvc Fax RemoteRegistry) do (sc config %%s start= disabled >nul 2>&1 & sc stop %%s >nul 2>&1)
schtasks /Change /TN "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator" /Disable >nul 2>&1
schtasks /Change /TN "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" /Disable >nul 2>&1
echo [OK] Servicios y limpieza optimizados.
timeout /t 2 >nul
call :UpdateProgress 13
echo.
echo ==============================================================
echo 14. AJUSTES DE RED
echo ==============================================================
netsh int tcp set global rss=enabled >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" /v "DisabledComponents" /t REG_DWORD /d 255 /f >nul 2>&1
netsh int tcp set global congestionprovider=cubic >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 0 /f >nul 2>&1
echo [OK] Red y caché ajustados.
timeout /t 2 >nul
call :UpdateProgress 14
echo.
echo ==============================================================
echo 15. PRIORIDAD CPU Y FONDO
echo ==============================================================
reg add "HKLM\SYSTEM\CurrentControlSet\Control\PriorityControl" /v "Win32PrioritySeparation" /t REG_DWORD /d 38 /f >nul 2>&1
echo [OK] Prioridad de CPU optimizada.
timeout /t 2 >nul
call :UpdateProgress 15
echo.
echo ==============================================================
echo 16. ACELERACIÓN GPU
echo ==============================================================
reg add "HKCU\Software\Microsoft\DirectX" /v "EnableGPUScaling" /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" /v "HwSchMode" /t REG_DWORD /d 2 /f >nul 2>&1
echo [OK] GPU optimizada.
timeout /t 2 >nul
call :UpdateProgress 16
echo.
echo ==============================================================
echo 17. EFECTOS VISUALES Y ENTRADA DE TEXTO (SEGURO)
echo ==============================================================
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /v "VisualFXSetting" /t REG_DWORD /d 2 /f >nul 2>&1
reg add "HKCU\Control Panel\Desktop\WindowMetrics" /v "MinAnimate" /t REG_SZ /d "0" /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "EnableTransparency" /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\TabletTip\1.7" /v "EnableAutoShiftEngage" /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\TextInput" /v "EnableTextPrediction" /t REG_DWORD /d 0 /f >nul 2>&1
taskkill /f /im explorer.exe >nul 2>&1 & timeout /t 2 >nul & start explorer.exe
echo [OK] Interfaz optimizada sin dañar LogonUI.
timeout /t 2 >nul
call :UpdateProgress 17
echo.
echo ==============================================================
echo 18. WINDOWS UPDATE MANUAL
echo ==============================================================
sc stop wuauserv >nul 2>&1 & sc config wuauserv start= demand >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DoNotConnectToWindowsUpdateInternetLocations" /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" /v "NoBandwidthThrottling" /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Services\DoSvc" /v "Start" /t REG_DWORD /d 4 /f >nul 2>&1
echo [OK] Actualizaciones en modo manual.
timeout /t 2 >nul
call :UpdateProgress 18
echo.
echo ==============================================================
echo 19. DETECCIÓN DE DISCO Y OPTIMIZACIÓN
echo ==============================================================
set "driveType=SSD"
powershell -NoProfile -Command "if((Get-PhysicalDisk | Where-Object{(Get-Partition -DiskNumber $_.DeviceId).DriveLetter -contains 'C'}).MediaType -eq 'HDD'){exit 0}else{exit 1}" >nul 2>&1
if %errorlevel% equ 0 set "driveType=HDD"
fsutil behavior set disabledeletenotify 0 >nul 2>&1
if /i "%driveType%"=="SSD" (defrag C: /L /U >nul 2>&1) else (defrag C: /O /U >nul 2>&1)
echo [OK] Disco [%driveType%] optimizado. TRIM activo.
timeout /t 2 >nul
call :UpdateProgress 19
echo.
echo ==============================================================
echo 20. LÓGICA ADAPTATIVA POR RAM
echo ==============================================================
:: (setlocal/endlocal eliminados aquí porque ya está activado globalmente al inicio del script)
if "%RAM_MB%"=="" goto END_RAM_CHECK
if %RAM_MB% LSS 8192 goto LOW_RAM_LOGIC
goto HIGH_RAM_LOGIC
:LOW_RAM_LOGIC
echo [+] RAM baja detectada (<8GB). Optimización extrema...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "EnableTransparency" /t REG_DWORD /d 0 /f >nul 2>&1
sc config SysMain start= disabled >nul 2>&1 & sc config WSearch start= disabled >nul 2>&1
goto END_RAM_CHECK
:HIGH_RAM_LOGIC
echo [+] RAM suficiente (>=8GB). Optimización de latencia...
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "DisablePagingExecutive" /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "DisableDynamicTick" /t REG_DWORD /d 1 /f >nul 2>&1
netsh int tcp set global autotuninglevel=normal >nul 2>&1
goto END_RAM_CHECK
:END_RAM_CHECK
timeout /t 2 >nul
call :UpdateProgress 20
echo.
echo ==============================================================
echo 21. GESTIÓN DE NAVEGADORES
echo ==============================================================
winget install Brave.Brave --silent --accept-package-agreements --accept-source-agreements >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" /v "ProgId" /d "BraveHTML" /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" /v "ProgId" /d "BraveHTML" /f >nul 2>&1
assoc .html=BraveHTML >nul 2>&1 & assoc .htm=BraveHTML >nul 2>&1 & assoc .pdf=BraveHTML >nul 2>&1
echo [OK] Brave instalado y configurado.
timeout /t 2 >nul
call :UpdateProgress 21
echo.
echo ==============================================================
echo 22. INSTALACIÓN Y ACTUALIZACIÓN DE SOFTWARE
echo ==============================================================
winget install --id VideoLAN.VLC -e --source winget --accept-source-agreements --accept-package-agreements >nul 2>&1
winget install --id RARLab.WinRAR -e --source winget --accept-source-agreements --accept-package-agreements >nul 2>&1
winget install --id nomacs.nomacs -e --source winget --accept-source-agreements --accept-package-agreements >nul 2>&1
winget upgrade --all --accept-source-agreements --accept-package-agreements >nul 2>&1
echo [OK] Software instalado/actualizado.
timeout /t 2 >nul
call :UpdateProgress 22
echo.
echo ==============================================================
echo 23. APLICANDO PRESET STANDARD (CHRIS TITUS WINUTIL STABLE)
echo ==============================================================
echo [+] Descargando y aplicando el preset 'Standard' de la rama Stable...
echo [+] Esto puede tomar unos minutos. Por favor, espere...
powershell -NoProfile -ExecutionPolicy Bypass -Command "& ([ScriptBlock]::Create((irm https://christitus.com/win))) -Preset Standard"
if %errorlevel% equ 0 (
echo [OK] Preset Standard aplicado exitosamente.
) else (
echo [!] ADVERTENCIA: Hubo un problema al ejecutar WinUtil. Verifica tu conexion a internet.
)
timeout /t 3 >nul
call :UpdateProgress 23
echo.
echo ==============================================================
echo 24. MEJORAS AUTOMÁTICAS RESCATADAS (V3/V4)
echo ==============================================================
for /f %%A in ('powershell -NoProfile -Command "[math]::Round((Get-PSDrive C).Free/1GB)"') do set FREE_GB=%%A
if %FREE_GB% GEQ 10 (DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase >nul 2>&1)
fsutil behavior query disabledeletenotify | findstr "0" >nul 2>&1 || fsutil behavior set disabledeletenotify 0 >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" /v 01 /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" /v 04 /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" /v 32 /t REG_DWORD /d 30 /f >nul 2>&1
if /i "%driveType%"=="HDD" chkdsk C: /F /R /X >nul 2>&1
for %%p in (explorer.exe dwm.exe) do (tasklist /fi "imagename eq %%p" 2>nul | findstr "%%p" >nul && wmic process where name="%%p" CALL setpriority "high priority" >nul 2>&1)
echo [OK] Mejoras aplicadas automáticamente.
timeout /t 2 >nul
call :UpdateProgress 24
echo.
echo ==============================================================
echo 25. ELIMINACIÓN SEGURA DE COPILOT/CORTANA/BING + PROTECCIÓN LOGONUI
echo ==============================================================
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowCopilotButton /t REG_DWORD /d 0 /f >nul 2>&1
powershell -NoProfile -Command "$s=@('*Copilot*','*Cortana*','*BingNews*','*BingWeather*'); foreach($p in $s){Get-AppxPackage -AllUsers $p|Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue; Get-AppxProvisionedPackage -Online|Where-Object{$_.PackageName-like $p}|Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue}" >nul 2>&1
powershell -NoProfile -Command "if(!(Test-Path '$env:SystemRoot\SystemApps\MicrosoftWindows.Client.CBS_*')){dism /online /cleanup-image /restorehealth >$null}" >nul 2>&1
echo [OK] Copilot/Cortana/Bing eliminados. LogonUI verificado y protegido.
timeout /t 2 >nul
call :UpdateProgress 25
echo.
echo ==============================================================
echo OPTIMIZACIÓN COMPLETADA v6.0 (100%%)
echo ==============================================================
echo Es recomendable reiniciar el equipo para aplicar todos los cambios.
echo Presiona cualquier tecla para salir...
pause >nul
exit
:: ====================================================================
:: SUBRUTINA PARA DIBUJAR LA BARRA DE PROGRESO DINÁMICA
:: ====================================================================
:UpdateProgress
set "step=%~1"
set "total=25"
set /a "percent=step * 100 / total"
set /a "blocks=step * 30 / total"
set /a "spaces=30 - blocks"
set "bar="
for /l %%i in (1,1,%blocks%) do set "bar=!bar!█"
for /l %%i in (1,1,%spaces%) do set "bar=!bar!░"
<nul set /p "=%CR% Progreso: [!bar!] !percent!%% (Paso !step! de !total!)"
goto :eof