In general, this command verifies and replaces incorrect versions of all protected system files with the correct versions. Upon detecting an overwritten protected file, this command retrieves the correct version of the file from the systemroot/system32/dllcache folder, and then replaces the incorrect version
Indeed,you must be logged on as a member of the Administrators group to run this command.
sfc [/scannow] [/verifyonly] [/scanfile=<file>] [/verifyfile=<file>] [/offwindir=<offline windows directory> /offbootdir=<offline boot directory>]
|/scannowE||Explicitly verifies the integrity of all protected system files and repairs problematic files when possible.|
|/verifyonly||Likewise analyzes the integrity of all protected system files without repairing them.|
||Further,this command checks the integrity of the specified file (full path and filename) and tries to correct any problems found.|
||This command likewise verifies the integrity of the specified file (complete path and filename), without performing any repairs.|
||For offline repair, specifies the location of the offline Windows directory.|
||Provides the location of the offline boot directory for offline repair.|
|/?||Displays help at the command prompt.|
SFC /scannow scans all protected system files, and replaces corrupted files with a cached copy located in a compressed folder at %WinDir%\System32\dllcache.
The %WinDir% placeholder represents the Windows operating system folder. For example, C:\Windows.
Note: Please do not close this Command Prompt window until the verification process is complete. The scan results will be displayed after this process is complete.
- Once the process is complete, you may receive one of the following messages:
- Windows Resource Protection did not find any integrity violations.This means that you do not have any missing or corrupted system files.
- Windows Resource Protection could not perform the requested operation.To resolve this problem, perform the System File Checker scan in safe mode, and make sure that the PendingDeletes and PendingRenames folders exist under %WinDir%\WinSxS\Temp.
- Windows Resource Protection found corrupt files and successfully repaired them. Details are included in the CBS.Log %WinDir%\Logs\CBS\CBS.log.To view the detail information about the system file scan and restoration, go to How to view details of the System File Checker process.
- Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log %WinDir%\Logs\CBS\CBS.log.
To repair the corrupted files manually, view details of the System File Checker process to find the corrupted file, and then manually replace the corrupted file with a known good copy of the file.
To verify the kernel32.dll file, type:
sfc /verifyfile=c:\windows\system32\kernel32.dll https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/sfc
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