如何从 SFC 中的“修复挂起”错误中恢复?

Sam*_*mir 10 windows-registry windows-vista services command-line

我正在尝试解决 Windows 注册表和服务的问题。我尝试运行 sfc 命令,但这是我收到的错误消息?

C:\Windows>sfc /scannow

Beginning system scan.  This process will take some time.    

There is a system repair pending which requires reboot to complete.  Restart
Windows and run sfc again.

C:\Windows>
Run Code Online (Sandbox Code Playgroud)

但是自从这条消息第一次出现以来,我已经重新启动了几次,我什至尝试在安全模式和控制台模式下运行该命令,但我仍然收到相同的消息。我该如何摆脱它?

winsxs文件夹中有这个文件:C:\Windows\winsxs\cleanup.xml

这是它的内容:

<?xml version='1.0' encoding='utf-16'?>
<PendingTransaction >
    <POQ postAction="NoReboot">
        <DeleteFile path="\??\D:\$$DeleteMe.CbsMsg.dll.01c85bd2f5893b40.0000"/>
    </POQ>
</PendingTransaction>
Run Code Online (Sandbox Code Playgroud)

这可能是什么吗?这是原因吗?删除此文件是否安全?

更新

我尝试重命名它,但操作失败。

我使用提升的权限运行 explorer.exe 并导航到该位置。我收到了 UAC 确认提示,然后是下面的错误。

Destination Folder Access Denied
You need permission to perform this action
Run Code Online (Sandbox Code Playgroud)

如何重命名或删除此文件?我是否需要使用 cmd 或处于安全模式才能执行此操作?

更新 2

我使用命令提示符启动了安全模式,并尝试获取文件的所有权,然后重命名它。重命名失败。

C:\Windows\winsxs>ren cleanup.xml cleanup.xml.old
Access is denied.

C:\Windows\winsxs>takeown /f "cleanup.xml"

SUCCESS: The file (or folder): "C:\Windows\winsxs\cleanup.xml" now owned by user
 "mycomputername\username".

C:\Windows\winsxs>ren cleanup.xml cleanup.xml.old
Access is denied.

C:\Windows\winsxs>
Run Code Online (Sandbox Code Playgroud)

我还发出了以下命令。

C:\Windows\system32>icacls "C:\Windows\winsxs\cleanup.xml" /grant username:F
processed file: C:\Windows\winsxs\cleanup.xml
Successfully processed 1 files; Failed processing 0 files

C:\Windows\system32>cd ..\winsxs

C:\Windows\winsxs>ren cleanup.xml cleanup.xml.old
Access is denied.

C:\Windows\winsxs>
Run Code Online (Sandbox Code Playgroud)

它仍然不允许我重命名它。我在正常的 Windows 模式下发出了最后两个命令。有关系吗?...我会尝试重新启动。

Blu*_*eft 12

我在 Windows 7 中遇到了同样的问题。我终于sfc从修复控制台使用以下命令运行(出于某种原因,它分配D:给了我的主磁盘,而不是C:

del d:\windows\winsxs\pending.xml
del x:\windows\winsxs\pending.xml
证监会 /scannow /offbootdir=D:\offwindir=D:\Windows

(然而,sfc现在告诉我

Windows 资源保护找到了损坏的文件,但无法修复其中的一些。

所以这并没有解决我的启动问题


mag*_*981 0

查看注册表中SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing是否看到名为 的键RebootPending。Windows 还可以在此处检查是否存在挂起的重新启动。