Windows 更新卡住:用命令行诊断并修复

针对 Windows 更新卡住的排查指南:查看更新历史、修复系统文件与组件存储、重置更新组件,并用 PowerShell 直接安装。

Windows更新系统终端PowerShell诊断审计中风险
先确认更新是否真的没装上:用 Get-HotFix 列出最近的更新记录,再做任何修复操作。

快速开始

当 Windows 更新在同一个百分比上停好几个小时,原因通常是下载缓存损坏、更新服务卡死或系统文件受损。本指南从诊断、修复到验证逐步带您排查,所有命令均可在管理员终端中运行。

症状

?更新进度条长时间冻结在某个百分比(常见为 0% 或某个两位数),设置中的 Windows 更新一直显示“正在下载”或“正在安装”,或者显示更新完成但更新历史里找不到对应的 KB 编号。

先查看已安装了哪些更新

动手之前,先确认那个“卡住”的更新到底是没装上,还是其实已经装好只是没显示。这决定了你要排查的是安装失败还是状态显示问题。看到一串带安装日期的 KB 编号列表,就说明这一步成功了。

被遗忘的 Get-HotFix cmdlet 一行命令即可回答"KBxxxxxxx 装了吗",本地远程都适用。

命令
$ Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10 HotFixID, Description, InstalledOn

用 SFC 修复系统文件

系统文件损坏是 Windows 更新安装中途卡住的常见原因。运行一次完整的系统文件检查,让它自动替换受损文件。扫描结束提示“未发现完整性冲突”或“已修复损坏文件”,即表示成功。

使用系统文件检查器逐一校验受保护的系统文件,并用完好的副本自动替换损坏的文件。

命令
$ sfc /scannow

用 DISM 修复组件存储

如果 SFC 无法完全修复,可能是因为它依赖的组件存储本身已损坏——而 Windows 更新正是从这个存储里安装的。运行 DISM RestoreHealth 修复它。进度到 100% 并提示操作成功完成,即表示成功。

使用 DISM 工具检测并修复 Windows 组件存储的损坏,这是 SFC 修复系统文件所依赖的底层来源。

命令
$ DISM /Online /Cleanup-Image /RestoreHealth

重置 Windows 更新组件

下载缓存损坏或更新服务卡死,是更新卡在某个百分比不动最典型的原因。先停止 BITS、Windows 更新和加密服务,重命名 SoftwareDistribution 缓存目录,再重启这些服务,让更新从头重新下载。所有服务都能正常停止和启动,即表示成功。

停止更新相关服务,重命名 SoftwareDistribution 下载缓存,再重新启动服务。

命令
$ net stop bits
net stop wuauserv
net stop cryptsvc
ren %Systemroot%\SoftwareDistribution\DataStore DataStore.bak
ren %Systemroot%\SoftwareDistribution\Download Download.bak
net start bits
net start wuauserv
net start cryptsvc

改用 PowerShell 安装更新

如果设置界面里的更新依然不动,可以完全绕过它:PSWindowsUpdate 模块能在命令行中搜索、下载、安装更新并自动重启,在设置界面失败时往往能成功。更新显示已安装、机器正常重启,即表示成功。

不打开设置界面,直接命令行搜索、下载、安装更新并重启,远程会话和服务器尤其方便。

命令
$ Install-Module PSWindowsUpdate -Force
Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot

确认更新已安装成功

修复并重启后,重新列出已安装更新,确认之前卡住的那个 KB 编号已经出现,且安装日期是最新的。列表中能看到该 KB 编号,就说明问题已解决。

从 PowerShell 查询所有已安装热修复的补丁号、类型和安装日期,是确认某个 KB 补丁是否真正落地的最快方法。

命令
$ Get-HotFix | Sort-Object InstalledOn -Descending | Format-Table HotFixID, Description, InstalledOn -AutoSize
!重命名 SoftwareDistribution 缓存会清除未完成的下载,Windows 会重新下载,下次检查更新会慢一些。DISM RestoreHealth 需要联网,可能耗时 10–20 分钟且进度条长时间不动,请勿中途打断。

如何确认已解决

重启电脑后重新列出已安装更新,确认之前等待的那个 KB 编号已经出现,且安装日期为最新。

来源

  • sfc | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    依据: Microsoft documents that 'sfc /scannow' scans the integrity of all protected system files and replaces incorrect versions with correct Microsoft versions.
  • Additional resources for Windows Update - Windows Client | Microsoft Learn
    learn.microsoft.com · community · 2026-09-21
    依据: Stop the BITS service, the Windows Update service and the Cryptographic service... net stop bits / net stop wuauserv / net stop cryptsvc ... Restart the BITS service, the Windows Update service and the Cryptographic service. net start bits / net start wuauserv / net start cryptsvc
  • Get-HotFix - List installed hotfixes - PowerShell
    SS64 · technical · 2026-09-17
    依据: SS64 shows Get-HotFix usage and notes it wraps the Win32_QuickFixEngineering WMI class for querying installed updates.
  • System File Checker (sfc) - Windows CMD
    SS64 · technical · 2026-09-17
    依据: SS64 describes the /scannow switch as scanning all protected system files immediately and repairing problems found.
  • Net - Services, File/Print shares, Permissions command - Windows CMD
    ss64.com · technical · 2026-09-21
    依据: Net - Services, File/Print shares, Permissions command - Windows CMD SS64 CMD How-to NET.exe The NET Command is used to manage network resources as follows: NET ACCOUNTS, GROUP, LOCALGROUP - Account settings and group members. NET COMPUTER, CONFIG_ - Network configuration (Workstation/Server). NET FILE, SESSIONS - Manage open files and user sessions. NET HELP, HELPMSG - Help. NET PRI
  • Get-HotFix (Microsoft.PowerShell.Management)
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: Documents Get-HotFix listing installed hotfixes, including filtering by HotFixID (KB number) or description, and querying remote computers via -ComputerName.
  • What is DISM? | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    依据: Microsoft describes DISM as a tool that services Windows images, including repairing the component store of a running online image.
  • PSWindowsUpdate
    PowerShell Gallery · community · 2026-09-17
    依据: Module page documenting Get-WindowsUpdate and Install-WindowsUpdate cmdlets built on the Windows Update Agent API.

最后验证: 2026-09-21

相关指南