sfc

扫描并验证所有受保护系统文件的完整性,并将错误的版本替换为正确的版本。 If this command discovers that a protected file has been overwritten, it retrieves the correct version of the file from the systemroot\ folder, and then replaces the incorrect file.

Important

必须以管理员组成员的身份登录才能运行此命令。

Syntax

sfc [/scannow] [/verifyonly] [/scanfile=<file>] [/verifyfile=<file>] [/offwindir=<offline windows directory> /offbootdir=<offline boot directory> /offlogfile=<log file path>]

Parameters

Parameter Description
/scannow 扫描所有受保护系统文件的完整性,并尽可能修复有问题的文件。
/verifyonly 扫描所有受保护系统文件的完整性,但不执行修复。
/scanfile 文件 <file> 扫描指定文件(完整路径和文件名)的完整性,并尝试修复检测到的任何问题。
/verify文件 <file> 验证指定文件(完整路径和文件名)的完整性,但不执行修复。
/offwindir <offline windows directory> 指定脱机 Windows 目录的位置以进行脱机修复。
/offbootdir <offline boot directory> 指定脱机启动目录的位置以进行脱机修复。
/offlogfile=<log file path> 指定一个用于存储日志文件的非默认位置。
/? 在命令提示符下显示帮助。

Examples

To verify the kernel32.dll file, type:

sfc /verifyfile=c:\windows\system32\kernel32.dll

To set up the offline repair of the kernel32.dll file with an offline boot directory set to D: and an offline windows directory set to D:\Windows, type:

sfc /scanfile=D:\windows\system32\kernel32.dll /offbootdir=D:\ /offwindir=d:\windows