Windows实用技巧

一条代码搞定win11开启/关闭自动更新

admin · 9月10日 · 2025年 · · · · 本文共617个字 · 预计阅读3分钟 225次已读
@echo off
:: ASCII 版本,适合任意编码(推荐保存为 UTF-8 无 BOM 或 ANSI)
net session >nul 2>&1
if %errorLevel% neq 0 (
  powershell -Command "Start-Process '%~f0' -Verb RunAs"
  exit /b
)

echo Checking Windows Update service...
sc query wuauserv | findstr /i "RUNNING" >nul
if %errorLevel%==0 (
  echo Disabling Windows Update...
  sc stop wuauserv
  sc config wuauserv start= disabled
  sc stop bits
  sc config bits start= disabled
  sc stop dosvc
  sc config dosvc start= disabled
  echo Done. Windows Update disabled.
) else (
  echo Enabling Windows Update...
  sc config wuauserv start= demand
  sc start wuauserv
  sc config bits start= demand
  sc start bits
  sc config dosvc start= demand
  sc start dosvc
  echo Done. Windows Update enabled.
)
pause
exit

把代码保存为 切换自动更新.bat。

双击运行

0 条回应