The sfc command in Windows

(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012)

(Applies to Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012)

The sfc command is responsible for scanning and verifying the integrity of all protected system files.As well as replacing incorrect file system versions with more accurate versions.To better understand how to use this command, see the example below.

Sfc command syntax

 sfc [/ scannow] [/ verifyonly] [/ scanfile =] [/ verifyfile =] [/ offwindir = / offbootdir =] 

Sfc command parameter

Parameters

Describe

/ scannow

Fully scan all protected system files, and fix problem files when possible.

/ verifyonly

Full scan of all protected system files.However, no corrective actions will be taken.

/ scanfile

Full scan of specified files and fix files if problems are found when possible.

 

Specify the full path and file name

/ verifyfile

Verify the integrity of the specified file.There will be no repairs done here.

/ offwindir

Specify the location of the offline windows directory to serve the offline repair process.

/ offbootdir

Specify the location of the folder to start offline

/?

Show help at thecommand prompt.

Sfc command comment

You must be logged on as a member of the Administrators group to run the sfc .exe executable file.

If the sfc command detects that a protected file has been overwritten, it will retrieve the correct version of the file from the systemrootsystem32dllcache folder, then replace the file incorrectly.

There are functional differences between the sfc command on Windows Server 2003, Windows Server 2008 and Windows Server 2008 R2, to see what this difference is, refer to the following articles:

  1. For more information about the sfc command on Windows Server 2003, see article 310747 in the Microsoft Knowledge Base.
  2. For more information on sfc commands on Windows Server 2008 and Windows Server 2008 R2, see the article about System File Checker.

Example sfc command

To verify kernel32.dll, type:

 sfc /verifyfile=c:windowssystem32kernel32.dll 

To set up offline repair for kernel32.dll file with the offline boot directory set to d: and the offline windows directory set to d: windows, type:

sfc /scanfile=d:windowssystem32kernel32.dll / offbootdir = d: / offwindir = d: windows

See more:

  1. RPC Server error is Unavailable in Windows Server 2008 R2
  2. Table summarizes the basic PowerShell commands
  3. Instructions for installing Windows Server 2012 step by step
  4. Install Windows Server 2008
4.8 ★ | 4 Vote