Microsoft DOS sfc command

Quick links

About sfc
Availability
Syntax
Examples

About sfc

Scans and replaces any Microsoft Windows file on the computer and replaces any changed file with the correct version. This is a great command to run when you are running into an issue that is difficult to troubleshoot.

Availability

The sfc.exe command is an external command that is available in the below Microsoft operating systems.

Windows 2000
Windows XP
Windows Vista
Windows 7
Windows 8

Syntax

Microsoft Windows Vista and later syntax
Microsoft Windows XP syntax
Microsoft Windows 2000 syntax

Microsoft Windows Vista and later 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 when possible.
/VERIFYONLY Scans integrity of all protected system files. No repair operation is performed.
/SCANFILE Scans integrity of the referenced file, repairs file if problems are identified. Specify full path <file>.
/VERIFYFILE Verifies the integrity of the file with full path <file>. No re pair 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.

Microsoft Windows XP syntax

SFC [/SCANNOW] [/SCANONCE] [/SCANBOOT] [/REVERT] [/PURGECACHE] [/CACHESIZE=x]

/SCANNOW Scans all protected system files immediately.
/SCANONCE Scans all protected system files once at the next boot.
/SCANBOOT Scans all protected system files at every boot.
/REVERT Return scan to default setting.
/PURGECACHE Purges the file cache.
/CACHESIZE=x Sets the file cache size.

Microsoft 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 once at the next boot.
/SCANBOOT Scans all protected system files at every boot.
/CANCEL Cancels all pending scans of protected system files.
/QUIET Replaces all 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

Examples

sfc /scannow

Begins the scan of all system files.

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

Check the kernal32.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 will appear after a few seconds.