This can be mighty useful in many situations, for instance when Windows features don’t work anymore, after an unexpected shutdown of the system, or after a virus attack.
The default command runs the file verification check on the active partition. What if you want to run a check on an external drive?
I ran into an issue today for instance where my main PC would not boot anymore. Windows ran an endless “trying to repair” loop but would not budge at all. I made the decision to connect the drive that Windows was installed on to another computer system, to run checks on it. One of those checks was the system file check using sfc.exe.
Run SFC /Scannow on external drives
You may run the sfc /scannow command on external drives, or internal drives with another Windows installation.
The process is nearly identical:
- Tap on the Windows-key on the keyboard, type cmd.exe, hold down the Ctrl-key and the Shift-key, and hit the Enter-key. This opens an elevated command prompt.
If you are interested in all switches that SFC supports, type SFC /?
The following command needs to be used to run the system file scan on another directory that is not the active system directory:
sfc /scannow /offwindir=d:windows /offbootdir=d:
Note that you need to replace d:windows with the correct directory. If the Windows installation is on t:win, replace the instance of d:windows in the example above with those.
The Windows tool runs a file system verification scan on the selected Windows directory, and tries to repair any issues that it finds.
Note that I’m not entirely sure how this works if the host system runs a different version of Windows than the system that is checked.
You can run the other sfc commands as well on other Windows directories:
- /verifyonly — This is like scannow, but won’t touch the files but simply validate them. Useful to verify without modifying any files potentially.
- /scanfile=file — This runs the scan on the selected file only, and not the full directory.
Messages that SFC may return
SFC may return the following messages:
- Windows Resource Protection did not find any integrity violations – No issues were found. This is good usually, unless you try to repair something.
- Windows Resource Protection could not perform the requested operation — You won’t get this error when you run SFC on an external drive or directory. If you do get the message, run SFC in the Safe Mode environment.
- Windows Resource Protection found corrupt files and successfully repaired them. Details are included in the CBS.Log %WinDir%LogsCBSCBS.log — Consult the log for information on what it fixed.
- Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log %WinDir%LogsCBSCBS.log — Like above, but now you need to consult the log to find out what SFC could not fix.
The file verification check can be useful, but it is not a 100% method of correcting Windows issues. I had to restore an earlier backup for instance, as the sfc command would not find anything wrong with the system files.