@echo off

net session >nul 2>&1
if %errorlevel% neq 0 (
  powershell -NoProfile -Command "Start-Process '%~f0' -Verb RunAs"
  exit /b
)

set "START=2025-01-01T00:00:00Z"
set "TARGET=2299-01-01T00:00:00Z"
REG ADD "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v FlightSettingsMaxPauseDays /t REG_DWORD /d 100000 /f >nul
REG ADD "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v PauseUpdatesStartTime           /t REG_SZ /d "%START%"  /f >nul
REG ADD "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v PauseUpdatesExpiryTime          /t REG_SZ /d "%TARGET%" /f >nul
REG ADD "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v PauseFeatureUpdatesStartTime    /t REG_SZ /d "%START%"  /f >nul
REG ADD "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v PauseFeatureUpdatesEndTime      /t REG_SZ /d "%TARGET%" /f >nul
REG ADD "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v PauseQualityUpdatesStartTime    /t REG_SZ /d "%START%"  /f >nul
REG ADD "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v PauseQualityUpdatesEndTime      /t REG_SZ /d "%TARGET%" /f >nul

echo 已延迟更新至2099年1月1日
pause
