The sfc (System File Checker) command scans all protected Windows system files and automatically replaces corrupt or missing ones from a compressed backup cache.

Random crashes, Blue Screen of Death errors, and unexpected system behavior are often caused by corrupt system files — sfc is the first tool to run when these occur.

Quick Answer

Open Command Prompt as administrator and run sfc /scannow. The scan takes 5–15 minutes and automatically repairs any corrupt system files it finds.

How to Use the sfc Command on Windows

Method 1: Run sfc via Command Prompt or PowerShell

This is the standard method for running a system file scan — it works on a normally booted system and covers the majority of corrupt file scenarios.

Open Command Prompt as administrator from the Start menu, then run the command below. The scan verifies all protected system files and repairs any it can access.

sfc /scannow
sfc /scannow running in Command Prompt on Windows

To view detailed scan logs, paste the path below into the Windows Run box (Win+R) to open the CBS.log file where sfc records every action it takes.

%WinDir%\Logs\CBS\CBS.log
Windows Run box with CBS.log path to view sfc scan logs

To extract only the SFC-related entries from the log file and save them to a separate text file, run the findstr command below in an elevated Command Prompt.

findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > C:\sfclogs.txt
findstr command to extract sfc log entries from CBS.log

Method 2: Run sfc via Windows Recovery Environment (WinRE)

Use WinRE when the system won’t boot or when sfc fails with “cannot perform the requested operation” in normal mode — it scans files offline without Windows interfering.

Hold Shift and click Restart from the Start menu to enter WinRE. If you can’t boot at all, interrupt the boot process three times and Windows will open WinRE automatically.

Navigate to Troubleshoot ? Advanced Options ? Command Prompt, then run sfc /scannow — the scan runs against the offline Windows installation.

WinRE Advanced Options — Command Prompt option for offline sfc scan
sfc /scannow running in WinRE Command Prompt

Method 3: Run sfc in Safe Mode

Safe Mode loads only basic drivers, which allows sfc to access and replace files that are locked by running services in a normal boot environment.

Enter WinRE, go to Troubleshoot ? Advanced Options ? Startup Settings, click Restart, and press 6 to boot into Safe Mode with Command Prompt.

WinRE Startup Settings to boot into Safe Mode with Command Prompt
Startup Settings menu — press 6 for Safe Mode with Command Prompt

Once Safe Mode with Command Prompt loads, run sfc /scannow — the reduced driver environment allows the tool to repair files that are normally in active use.

sfc /scannow running in Safe Mode Command Prompt

sfc Command Flags Reference

Flag What It Does
/scannow Scans all protected files and repairs corrupt ones
/verifyonly Scans for integrity violations — no repair
/scanfile=path Scans and repairs a specific file by full path
/verifyfile=path Verifies a specific file — no repair attempted
/offbootdir=dir Specifies boot directory for offline scans (WinRE)
/offwindir=dir Specifies Windows directory for offline scans (WinRE)

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

This error means sfc could not access a file it needed to repair — typically because the file is locked by a running process or the Windows image itself is corrupted.

Run the offline scan from WinRE using the command below — replace e:\ with your actual boot drive letter and c:\Windows with your Windows installation directory.

sfc /scannow /offbootdir=e:\ /offwindir=c:\Windows
sfc offline scan command with /offbootdir and /offwindir flags in WinRE

When sfc Fails: Use the DISM Command

If sfc cannot repair the corrupt files, run DISM first — it repairs the Windows component store that sfc uses as its repair source, then re-run sfc afterward.

DISM uses Windows Update to download a clean copy of any damaged component. Run it from an elevated Command Prompt — an internet connection is required for this command.

DISM.exe /Online /Cleanup-Image /RestoreHealth
DISM /RestoreHealth command running in elevated Command Prompt

After DISM completes, run sfc /scannow again — with a repaired component store, sfc can now find and apply replacement files it previously could not access.

When to Run sfc /scannow

Run sfc when Windows shows random crashes, application errors, or missing DLL messages — corrupt system files are a common cause of all three of these symptoms.

Run sfc after a failed Windows Update or an interrupted system upgrade — the update process can leave files in a partially replaced state that sfc can detect and repair.

Run sfc in Safe Mode or WinRE if normal mode scans keep reporting errors — some system files cannot be replaced while they are actively loaded into memory by Windows.

Related Guides

These Windows diagnostic tools work alongside sfc to fix drive errors, track network issues, and keep your system running correctly after file system problems.