@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。
双击运行
