Copilot created this file to shrink windows.
I copied the text and saved it a batch file.
.......................................
@echo off
title Windows 11 Post‑Install Optimization (Safe + Long‑Term)
color 0A
echo ============================================
echo Windows 11 Post‑Install Optimization
echo Safe, Update‑Friendly, Long‑Term Cleanup
echo ============================================
echo.
:: 1. Disable hibernation (removes hiberfil.sys)
echo Disabling hibernation...
powercfg /hibernate off
:: 2. Set pagefile to system-managed
echo Setting pagefile to system-managed...
wmic computersystem where name="%computername%" set AutomaticManagedPagefile=True >nul
:: 3. WinSxS cleanup
echo Cleaning WinSxS component store...
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
:: 4. Windows Update leftovers
echo Cleaning Windows Update leftovers...
cleanmgr /sageset:1 >nul
cleanmgr /sagerun:1
:: 5. Clear Delivery Optimization cache
echo Clearing Delivery Optimization cache...
del /q /s %SystemRoot%\SoftwareDistribution\Download\* >nul 2>&1
:: 6. Clear Windows Event Logs
echo Clearing Windows event logs...
for /F "tokens=*" %%G in ('wevtutil el') DO wevtutil cl "%%G" >nul 2>&1
:: 7. Clear temp folders
echo Clearing TEMP folders...
del /q /f /s "%TEMP%\*" >nul 2>&1
del /q /f /s "C:\Windows\Temp\*" >nul 2>&1
:: 8. Disable Reserved Storage (saves 7GB)
echo Disabling Reserved Storage...
Dism /Online /Set-ReservedStorageState /State

isabled
:: 9. Disable Xbox services
echo Disabling Xbox services...
for %%S in (XblAuthManager XblGameSave XboxNetApiSvc XboxGipSvc) do (
sc stop %%S >nul 2>&1
sc config %%S start= disabled >nul 2>&1
)
:: 10. Disable Copilot, Widgets, Chat
echo Disabling Copilot, Widgets, and Chat...
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f >nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" /v ChatIcon /t REG_DWORD /d 3 /f >nul
:: 11. Remove unused inbox apps
echo Removing unused inbox apps...
powershell -command "Get-AppxPackage Microsoft.3DBuilder | Remove-AppxPackage" >nul
powershell -command "Get-AppxPackage Microsoft.MSPaint | Remove-AppxPackage" >nul
powershell -command "Get-AppxPackage Microsoft.WindowsMaps | Remove-AppxPackage" >nul
powershell -command "Get-AppxPackage Microsoft.GetHelp | Remove-AppxPackage" >nul
powershell -command "Get-AppxPackage Microsoft.Getstarted | Remove-AppxPackage" >nul
powershell -command "Get-AppxPackage Microsoft.People | Remove-AppxPackage" >nul
powershell -command "Get-AppxPackage Microsoft.ZuneMusic | Remove-AppxPackage" >nul
powershell -command "Get-AppxPackage Microsoft.ZuneVideo | Remove-AppxPackage" >nul
:: 12. Clear Microsoft Store cache
echo Resetting Microsoft Store cache...
wsreset -i
:: 13. Disable telemetry
echo Disabling telemetry...
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f >nul
:: 14. Disable background apps
echo Disabling background apps...
powershell -command "Get-AppxPackage | %% { Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\'+$_.Name -Name Disabled -Value 1 -ErrorAction SilentlyContinue }" >nul
echo.
echo ============================================
echo Optimization Complete
echo Restart recommended
echo ============================================
pause