Sfc command

Updated: 11/12/2023 by Computer Hope
sfc command

Short for system file checker, SFC is a command that scans and replaces any Microsoft Windows file with the correct version. The sfc command is excellent when you run into an issue that is difficult to troubleshoot.

Availability

Sfc command is an external command available for the following Microsoft operating systems as sfc.exe.

Sfc syntax

Windows 10 and 11 syntax

SFC [/SCANNOW] [/VERIFYONLY] [/SCANFILE=<file>] [/VERIFYFILE=<file>]
    [/OFFWINDIR=<offline windows directory> /OFFBOOTDIR=<offline boot directory> 
    [/OFFLOGFILE=<log file path> ]]
/SCANNOW Scans integrity of all protected system files and repairs files with problems.
/VERIFYONLY Scans integrity of all protected system files. No repair operation is performed.
/SCANFILE Scans integrity of the referenced file, and then repairs file if problems are identified. Specify full path <file>.
/VERIFYFILE Verifies the integrity of the file with full path <file>. No repair operation is performed.
/OFFBOOTDIR For offline repair, specify the location of the offline boot directory.
/OFFWINDIR For offline repair, specify the location of the offline Windows directory.
/OFFLOGFILE For offline repair, optionally enable logging by specifying a log file path.

Windows Vista, 7, and 8 syntax

SFC [/SCANNOW] [/VERIFYONLY] [/SCANFILE=<file>] [/VERIFYFILE=<file>]
  [/OFFWINDIR=<offline windows directory> /OFFBOOTDIR=<offline boot directory>]
/SCANNOW Scans integrity of all protected system files and repairs files with problems.
/VERIFYONLY Scans integrity of all protected system files. No repair operation is performed.
/SCANFILE Scans integrity of the referenced file, and then repairs file if problems are identified. Specify full path <file>.
/VERIFYFILE Verifies the integrity of the file with full path <file>. No repair operation is performed.
/OFFBOOTDIR For offline repair, specify the location of the offline boot directory.
/OFFWINDIR For offline repair, specify the location of the offline Windows directory.

Windows XP syntax

SFC [/SCANNOW] [/SCANONCE] [/SCANBOOT] [/REVERT] [/PURGECACHE] [/CACHESIZE=x]
/SCANNOW Scans all protected system files immediately.
/SCANONCE Scans all protected system files on the next boot.
/SCANBOOT Scans all protected system files on every boot.
/REVERT Return scan to its default settings.
/PURGECACHE Purges the file cache.
/CACHESIZE=x Sets the file cache size.

Windows 2000 syntax

SFC [/SCANNOW] [/SCANONCE] [/SCANBOOT] [/CANCEL] [/ENABLE] 
    [/PURGECACHE] [/CACHE SIZE=x] [/QUIET]
/SCANNOW Scans all protected system files immediately.
/SCANONCE Scans all protected system files on the next boot.
/SCANBOOT Scans all protected system files on every boot.
/CANCEL Cancels all the pending scans of protected system files.
/QUIET Replaces all the incorrect file versions without prompting the user.
/ENABLE Enables Windows File Protection for normal operation.
/PURGECACHE Purges the file cache and scans all protected system files immediately.
/CACHESIZE=x Sets the file cache size

Sfc examples

Note

In Windows Vista, Windows 7, Windows 8, Windows 10, and Windows 11, you must be running in an elevated command mode for the SFC command to work correctly. Otherwise, you receive the "You must be an administrator running a console session to use the sfc utility" error when you attempt to run any of the following examples.

sfc /scannow

Begins the scan of all system files.

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

Check the kernel32.dll file for any problems. If no problems are found with the file scanned, a "Windows resource protection did not find any integrity violations" message appears after a few seconds.

Tip

The dism command can also be used to scan for Windows corruption.