Windows
Run SFC from the Windows recovery environment
On this page
System File Checker (SFC) finds damaged or missing Windows system files and replaces them with good copies. Normally you run sfc /scannow from inside Windows. But when Windows won’t start, or keeps crashing before you can get to a command prompt, you can run SFC against the installation from the Windows Recovery Environment instead. This is called an offline scan.
1. Open a recovery Command Prompt
Use whichever of these you can get to:
- From Windows, if it still starts: go to Settings > System > Recovery and click Restart now next to Advanced startup. Or hold Shift while you click Restart.
- If Windows won’t start: after two or three failed starts in a row, Windows opens the recovery screens by itself.
- From a USB stick or DVD: start the PC from Windows installation media, choose your language, then click Repair your computer instead of Install.
Then choose Troubleshoot > Advanced options > Command Prompt.
2. Find the Windows drive letter
In the recovery environment, drive letters often change. The drive that’s C: in Windows is frequently D: here. Check which one holds the Windows folder:
dir C:\Windows
dir D:\Windows
The right drive lists folders such as System32. If neither works, run diskpart, then list volume to see every drive with its size and label, and exit to leave.
If the drive is protected by BitLocker, you’ll be asked for the recovery key, or you can unlock it from the command prompt with manage-bde -unlock D: -RecoveryPassword followed by the 48-digit key. Business devices usually have the key stored in Microsoft Entra ID or Active Directory, and personal ones in the Microsoft account at account.microsoft.com/devices/recoverykey.
3. Run the offline scan
Using the drive letter you found (D: in this example):
sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows
Change both drive letters if yours is different. The scan takes 10 to 30 minutes. When it finishes, it tells you one of three things:
- Did not find any integrity violations: the system files are fine, so the problem is somewhere else, such as a driver, a failed update or the disk itself.
- Found corrupt files and successfully repaired them: type
exit, choose Continue and see whether Windows starts. - Found corrupt files but was unable to fix some of them: SFC’s own store of good copies is damaged too. Try Troubleshoot > Advanced options > Uninstall Updates if the trouble started after an update, or a repair install of Windows that keeps your files and apps.
If SFC won’t run
- “There is a system repair pending which requires reboot to complete”: a half-finished update is in the way. From the same command prompt,
dism /image:D:\ /cleanup-image /revertpendingactionsundoes it, then try SFC again. - “Windows Resource Protection could not start the repair service”: check you used
/offwindirand/offbootdirwith the right drive letter. Without them, SFC tries to check the recovery environment itself. - Errors reading the disk: run
chkdsk D: /ffirst. If the disk is failing, copy off anything important before trying more repairs.