@echo off title 彻底禁用 Windows 自动更新 :: ============================================================ :: 彻底禁用 Windows 自动更新脚本 (CMD/Batch) :: 适用: Windows 10 / 11 :: 必须以管理员身份运行 :: ============================================================ :: ---------- 检查管理员权限 ---------- net session >nul 2>&1 if %errorLevel% neq 0 ( echo [错误] 请以管理员身份运行此脚本! pause exit /b ) echo. echo ============================================ echo 正在禁用 Windows 自动更新... echo ============================================ echo. :: ---------- 1. 停止并禁用核心更新服务 ---------- echo [1/5] 正在停止并禁用更新服务... for %%i in (wuauserv UsoSvc WaaSMedicSvc BITS dosvc) do ( echo 正在处理服务: %%i net stop %%i /y >nul 2>&1 sc config %%i start= disabled >nul 2>&1 sc failure %%i reset= 0 actions= "" >nul 2>&1 ) :: ---------- 2. 注册表策略:禁用自动更新 ---------- echo [2/5] 正在写入注册表策略... reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f >nul 2>&1 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AUOptions /t REG_DWORD /d 1 /f >nul 2>&1 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v AlwaysAutoRebootAtScheduledTime /t REG_DWORD /d 0 /f >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 :: ---------- 3. 强制禁用 WaaSMedicSvc (更新修复服务) ---------- echo [3/5] 正在强制禁用 WaaSMedicSvc... reg add "HKLM\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc" /v Start /t REG_DWORD /d 4 /f >nul 2>&1 :: ---------- 4. 禁用更新相关计划任务 ---------- echo [4/5] 正在禁用更新相关计划任务... schtasks /change /tn "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\UpdateOrchestrator\Schedule Scan Static Task" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\UpdateOrchestrator\UUS Failover Task" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\WindowsUpdate\Scheduled Start" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\WindowsUpdate\sih" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\WindowsUpdate\sihboot" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\WindowsUpdate\Automatic App Update" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\InstallService\ScanForUpdates" /disable >nul 2>&1 schtasks /change /tn "\Microsoft\Windows\InstallService\ScanForUpdatesAsUser" /disable >nul 2>&1 :: ---------- 5. 屏蔽更新服务器 (hosts 文件) ---------- echo [5/5] 正在屏蔽更新服务器... set "hosts=C:\Windows\System32\drivers\etc\hosts" findstr /c:"windowsupdate.microsoft.com" "%hosts%" >nul 2>&1 if %errorLevel% neq 0 ( echo 0.0.0.0 windowsupdate.microsoft.com >> "%hosts%" echo 0.0.0.0 download.microsoft.com >> "%hosts%" echo 0.0.0.0 update.microsoft.com >> "%hosts%" echo 0.0.0.0 windowsupdate.com >> "%hosts%" echo 0.0.0.0 wustat.windows.com >> "%hosts%" echo 0.0.0.0 ntservicepack.microsoft.com >> "%hosts%" echo 0.0.0.0 statsfe2.ws.microsoft.com >> "%hosts%" echo 0.0.0.0 corporate.stats.microsoft.com >> "%hosts%" ipconfig /flushdns >nul 2>&1 ) echo. echo ============================================ echo 完成!建议重启电脑使设置完全生效。 echo ============================================ echo. pause