System Files - SFC Command

ByLine
How to Repair and Verify the Integrity of Vista System Files with System File Checker
Synopsis
System File Checker (SFC) checks that all Vista files are where they should be and that they are uncorrupted. This will show you how to verify and repair the integrity of Vista system files with the System File Checker (SFC) command codes.
How to Repair and Verify the Integrity of Vista System Files with System File Checker

information   Information
System File Checker (SFC) checks that all Vista system files are where they should be as they were by default and not corrupted, changed, or damaged. This will show you how to verify and repair the integrity of Vista system files with the System File Checker (SFC) command codes.
Tip   Tip
If SFC Cannot Finish or Repair a File:
NOTE:
This is for when after you run the SFC scan below, it cannot finish or repair a file. There is no guarantee that SFC can repair the system files if they are corrupted or damaged to much. If SFC still cannot repair them after this, then you might try running Check Disk (chkdsk), System Restore, a Repair Installation, or a clean reinstall of Vista.

1. How to Read the CBS.LOG
NOTE:
When SFC runs, it logs it's actions to the C:\WINDOWS\LOGS\CBS\CBS.LOG. You can find the specific SFC entries by searching for the [SR] tags in the log.
A) For how to see only the SFC scan details in the CBS.LOG:​
  • Open a elevated command prompt.
  • Copy and paste the command below into the elevated command prompt and press Enter.
    Code:
    findstr /c:"[SR]" %windir%\logs\cbs\cbs.log >%userprofile%\Desktop\sfcdetails.txt
  • Close the elevated command prompt.
  • Click on the sfcdetails.txt file that was just placed on your desktop to see the SFC scan details (ones with the [SR] tags) in the CBS.LOG.
  • You can safely delete the sfcdetails.txt file afterwards if you like.
2. Replace the Files that SFC Cannot Fix
NOTE:
If SFC cannot fix a file, it will be listed in the CBS.LOG above. Read the CBS.LOG to find out what file it is so you can replace it with a good copy.
A) For how, see:​
warning   Warning
Be aware that if you have modified your system files as in theming explorer/system files, running sfc/scannow will revert the system files such as explorer.exe back to it's default state. Make the appropriate backups of your system files that you have modified for theming if you wish to save them before running sfc/scannow.




Here's How:
NOTE:
If sfc cannot start or finish, then try running it Safe Mode.
2. In the elevated command prompt, type the command that you want to do in bold below in steps A to E to run System File Check.​
A) sfc /scannow - Scans the integrity of all protected system files and repairs the system files if needed. (See screenshot below)​
NOTE: Restores Vista's original setup of system files. (EX: Fonts, wallpapers, System32 files, etc.)
scannow.jpg

B) sfc /verifyonly - Scans and only verifies the integrity of all proteced system files only. (See screenshot below)​
NOTE: If it finds anything like in the screenshot below boxed in red at the bottom, you should run step A to see if it can fix it. See how to read the CBS log above for details on the SFC scan results.​
verifyonly.jpg

C) sfc /scanfile=(full path of file) - Scans the integrity of the chosen system file and repairs it if needed.​
EX: sfc /scanfile=C:\Windows\System32\kernel32.dll​
D) sfc /verifyfile=(full path of file) - Scans and only verifies the integrity of the chosen system file.​
EX: sfc /verifyfile=C:\Windows\System32\kernel32.dll​
E) sfc /? - For a list of all sfc command codes with description. (see screenshot below)​
SFC_Help.jpg


3. Press Enter.​
NOTE: It may take a while to finish.​
4. Close the elevated command prompt when it finishes.​
5. If you got a message to restart the computer in the command prompt, then restart the computer to finish the repair.​

Note   Note
If SFC could not fix something, then run the command again to see if it may be able to the next time. Sometimes it may take running the sfc /scannow command 3 times restarting the PC after each time to completely fix everything that it's able to.

If not, then download and run the 32-bit (x86) or 64-bit (x64) System Update Readiness Tool for your same installed 32-bit or 64-bit Vista, restart the PC afterwards, and try the sfc /scannow command again.

If still not, then you can attempt to run a System Restore using a restore point dated before the bad file occured to fix it. You may need to repeat doing a System Restore until you find a older restore point that may work.

If still not, then you can use the steps in the yellow TIP box at the top of the tutorial to manually replace the files that SFC could not fix.




That's it,
Shawn


Related Tutorials



 
Last edited by a moderator:
Shawn Brink

Comments

Sfc /scannow is finding corrupt files even after doing a chkdsk /f and a chkdsk /r (Good news is Chkdsk is still working at this moment in time). Windows Update downloaded 63 new files yesterday or something like that, personally I hate how it automaticly downloads stuff.

Should I do a system restore to yesterday when at least the sfc wasnt finding corrupt files?

If so is there a way to stop the automatic update? and should I stop them?
 
Last edited:
I've got an interesting problem to add. Vista Home Premium XP1 Dell XPS1530 laptop. Won't boot at all (not even to safe mode). Got to command prompt with vista DVD. Ran chkdsk /r... no errors. Ran sfc by sfc /scannow /offbootdir=c:\ /offwindir=c:\windows. Indicates it found corrupt files, but was unable to fix. Check c:\windows\logs\cbs\cbs.log. I can open this file with notepad from the command prompt, but the last entry is from 6 hours ago?! Is it not writing to the log? Any ideas? I feel excited that I'm getting closer to the root of the problem only to be shutdown at step that told me where the actual issue is. :( Please help! Thanks.
 
Personally, I would do a clean install. Because if your not able to boot even in safe mood than your experiencing extreme problems. Even if you do get into the CBS.log the number of files that are probably corrupt will take forever for you to fix. You may want to check your BIOS though and see the order its having your computer boot in.
 
Hello Pempey, and welcome to Vista Forums.

I'm sorry, but I must agree with MarryPoppins and recommend a clean reinstall of Vista. It sounds like your computer is beyond a simple repair. :(

Sorry,
Shawn
 
Thanks everyone, I guess deep down in inside I felt everything was pointing to doing a clean install. My question is... I don't know what the original cause of the problem was and I really don't want a recurrence. If, for example, it was random bad sectors on the hard drive where important OS files were saved, is there a way to scan and mark them before (or during) the clean install? Are there other causes that I should do some sort of diagnostic process on first before the clean install?

Thanks again!
 
I have run into a problem trying to remove a restore point. I used disk cleanup and TuneUp Utilities but it will not remove this restore point entitled UNKNOWN. It removed all up to it and then stoped. Tried several times. It says one file cannot be deleted, as it is currently in use or you do not have the necessary permissions. I will be reading all I can here but if you could send me in the right direction that would be great. I tried a screenshot but don't know how to do it or upload it. Thanks, as allways comments welcome. I just did a factory recover 7 days ago and man I hate to go thur that again, everything was going so great.
 
Yes it worked, I did as you said and then created a Restore Point. The system said it was successful and I pick up 30GB of space not that I needed it but I did not want to go back and do all the downloads or SP1 again. Thank You so much:)
 
Thanks for this info! I was having a bugger of a problem with Windows' Programs and Features control panel app not opening, and running this process (and replacing several corrupt files manually) solved the problem! Now if only I could install Visual Studio 2008... Maybe this will fix that problem, too...
 
Your welcome Severtki. You might post about the problem with Visual Studio 2008 in the Software forum to see what suggestions you may get to help you with it.

Shawn
 
Hi all!!
In a miguided attempt to grab some more drive space, I deleted %SystemDrive%\Windows\System32\DriverStore\FileRepositor. Now vista won't recognise most of my usb devices.
Will System File Checker be able to help me?
I'm running a pre-installed version of Home Premium so I don't have a dvd to do a repair install.
Any suggestions would be much appreciated!!!!
Phanmo
 
Thanks for the welcome!!

Unfortunately I didn't notice the problem for quite some time, not having needed any usb devices. All the system restore points I have are too recent to be any help. I'm going to try and copy the FileRepository from a friend's computer and stick it on mine.
Again, any suggestions would be very welcome!!
Cheers!!
 
Hi all!!
In a miguided attempt to grab some more drive space, I deleted %SystemDrive%\Windows\System32\DriverStore\FileRepositor. Now vista won't recognise most of my usb devices.
Will System File Checker be able to help me?
I'm running a pre-installed version of Home Premium so I don't have a dvd to do a repair install.
Any suggestions would be much appreciated!!!!
Phanmo
I agree do a system restore first, go back to a restore point when everything was working. There is a box that you can check to see all your restore points. If you can not do a sysrem restore, as a last resort do a system recovery from you disk that should have a partition D that you can use to put your computer back to the factory settings.To do a System Restore just click on control panel and if not allready click on classic view and locate Backup and restore center, double click on the icon and then click Repair Windows using system restore. Any problems just post back the people here are great to help. I don't know if System File Checker is able to help here perhaps someone else has the answer to that question.
 
Top