Are you facing random crashes or experiencing unexpected system behavior? Most of the time, the corrupt system files are responsible for these issues. These corrupt files can also trigger the Blue Screen of Death and you can lose all the unsaved data. To fix such corrupt files, Microsoft has added the “SFC” command.

The “SFC” stands for “System File Checker” and is a Windows command-line tool that enables you to repair corrupt and missing system files. It works by replacing the corrupt system files from the compressed folder “%WinDir%\System32\dllcache”.

Content Overview:

This guide sheds light on the use of the “SFC command on Windows” to repair your system’s corrupt files and explains:

Let’s begin fixing your system’s corrupt files.

How to Use the SFC Command on Windows

You can use the SFC command and fix the corrupt system files from:

  • The Windows PowerShell/Command Prompt.
  • Windows Recovery Environment.
  • Safe Mode.

Use the SFC Command Via the Windows PowerShell/Command Prompt 

Run the following command in the Windows PowerShell or Command Prompt to trigger the “SFC Scan” to find and fix the corrupt system files:

sfc /scannow

You can view logs of the “SFC Windows Command” using the following signature in the Windows Run Box:

%WinDir%\Logs\CBS\CBS.log

It opens the CBS.log file for further analysis of the “SFC” command’s output:

To view a more filtered result, execute the following command:

findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > C:\sfclogs.txt"

Use the SFC Command Via the Windows Recovery Environment

When you are facing boot-related issues, Microsoft recommends using the Windows Recovery Environment or WinRE to fix the issues. It comes with several tools, including the Command Prompt to fix your system. To run a “SFC Scan” via the Windows Recovery Environment, follow these steps:

Step 1: Open Windows Recovery Environment by pressing and holding the “Shift” key and then using the “Restart” button from the Windows Start Menu. If you are unable to boot, interrupt the boot process by switching off the power three times, and it will trigger the WinRE automatically.

Step 2: Navigate to Troubleshoot ? Advanced Options and then select the Command Prompt:

Once the Command Prompt opens, use the “sfc /scannow” command to begin checking the system file’s integrity and fix them accordingly:

Use the SFC Command Via the Safe Mode

The “Safe Mode” is also known as the Windows diagnostic mode. It starts the OS with only the basic drivers and utilities. If you cannot run the SFC scan in normal mode, boot the system into safe mode and use the Offline SFC Scan. Follow the below-stated steps to perform a SFC scan via the Safe Mode:

Step 1: Boot Into Safe Mode

Step 2: Perform SFC Scan in Safe Mode

The illustration of the above steps is as follows:

Step 1: Boot Into Safe Mode

To boot into safe mode, open Windows Recovery Environment and then navigate to Troubleshoot ? Advanced Options ? Startup Settings and use the Restart button:

Now press the “6” key when the system reboots:

Step 2: Perform SFC Scan in Safe Mode

After booting into “Enable Safe Mode with Command Prompt” via the Windows Recovery Environment, the Command Prompt opens automatically. Now run the “SFC Scan in Safe Mode” using the following command:

sfc /scannow

Additional Flags for the SFC Command

While the “sfc /scannow” checks the file’s integrity and attempts to repair the corrupt system files, there are some other flags as well, including:

  1. /verifyonly: The “sfc /verifyonly” command performs an integrity check on the system’s files and gives detailed information but doesn’t fix any file.
  2. /scanfile=file: If you want to check and repair a particular file, use the “/scanfile=file” flag.
  3. /verifyfile=file: Use this flag to only check the file’s integrity without attempting to repair it.
  4. /offbootdir=directory: This flag is usable while running the “sfc scan” via the Windows Recovery Environment. It specifies the location of the boot directory.
  5. /offwindir=directory: This flag is only usable in the Windows Recovery Environment. It specifies the location of the directory where the Windows is installed.

How to Fix the Error “Windows Resource Protection Could Not Perform the Requested Operation”

While using the “SFC” command on Windows, you may get either of the following outputs:

  1. The WRP did not find any integrity violations: This indicates that you do not have any corrupt system files on your computer.
  2. The WRP could not perform the requested operation. If you get this message while running the SFC scan on your system, use the Offline SFC Scan by executing the following command; 
sfc /scannow /offbootdir=e:\ /offwindir=c: /Windows

Here the “e” is the system’s boot drive and “c” is the Windows directory:

How and When to Use the DISM.exe Command on Windows

If the “SFC” command is not fixing the corrupt system files, use the “DISM.exe” or “Deployment Image Servicing and Management” utility and then try again. Although these “SFC” and “DISM” are not interlinked, the DISM can help the “SFC” by fixing the system image and the critical system files. 

The “DISM.exe” works using the Windows Update and services the Windows Image (.WMI Files). Execute the following command to use it:

DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:C:\RepairSource\Windows /LimitAccess

After using the “DISM.exe” utility, try using the “SFC” command again to fix the corrupt system files.

Final Words

The “SFC Windows Command” enables you to verify the system file’s integrity and attempts to fix the corrupt system files (if found during the scan). You can run it via the Windows PowerShell/Command Prompt, Windows Recovery Environment, and Safe Mode. If it is unable to repair the corrupt system files, try using the “DISM.exe” utility and then retry. This guide has shed light on the SFC command on Windows.