Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar
* * * * * 4 votes

How To Use Sfc.exe To Repair System Files


  • This topic is locked This topic is locked
30 replies to this topic

#1 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad


  •  Avatar image
  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:10:27 AM

Posted 02 February 2006 - 05:35 PM

How to Use SFC.EXE to Repair System Files



Guide Overview

The purpose of this guide is to teach you how to use the System File Checker (SFC) to examine and repair corrupt operating system files.

In doing this, the SFC tool may replace some of your files that were updated by Windows Update. The only way to check this (and to update any of the files) is by visiting Windows Update and allowing it to check your system for updates and update as needed.

References

Description of Windows XP and Windows Server 2003 System File Checker (Sfc.exe)

Microsoft Windows XP - Repair overview (Link doesn't work as of 06 Aug 2008)

This link discusses the repair options: http://www.microsoft.com/windowsxp/using/s...rt/nostart.mspx

Instructions
  • Locate your Windows XP installation CD. If you don't have one, you'll need to locate a directory on your system that's named"i386" (without the quotes). This directory may be on a hidden partition on your hard drive.

  • Go to Start, then to Run, and type in "SFC.EXE /SCANNOW" (without the quotes - and with a space between the SFC.EXE and the /SCANNOW). The press Enter. (For VISTA, go to Start and type in the above information, then go to the top of the box and right click on SFC.EXE /SCANNOW and select "Run As Administrator")

  • The program may (or it may not) ask you for your Windows XP installation CD - please insert it at the prompt. If it doesn't ask you for the CD this means that it wasn't necessary to replace any files.

  • In the event the the system asks you for the CD, you must visit Windows Update immediately after the scan is completed (Please note that there won't be any confirmation dialog - the program will just exit without telling you anything).

  • If this doesn't repair the problem with your system other troubleshooting procedures are required.

My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

BC AdBot (Login to Remove)

 


#2 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad

  • Topic Starter

  •  Avatar image
  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:10:27 AM

Posted 05 October 2006 - 08:14 AM

There have been some issues with running SFC.EXE /SCANNOW that this article doesn't address. They are:
1) The system won't accept the original installation disk because it doesn't have Service Pack 2 on it.
2) You don't have a Windows installation CD - only a restore CD from the manufacturer.

Here's how to deal with them:
__________________________________________________________________________

To fix the SP2 issue, you'll have to "slipstream" SP2 along with your installation CD. Rather than going through all the gory details here, just visit this link: http://www.winsupersite.com/showcase/windo..._slipstream.asp It provides a detailed explanation of how to slipstream SP2 along with your Windows installation CD.
__________________________________________________________________________

To fix the problem when you only have a restore CD you'll have to search for a folder on your hard drive (or on the restore CD) that's named "i386" (without the quotes). Once you find that, copy it to your hard drive at the root (C:\i386). Make sure that the directory is located at the root of your C: drive (C:\i386) - if not, then you'll need to change the path to the proper entry in the registry edit.

Then perform this registry edit to point SFC.EXE at it:

So, the first step is to backup your registry. The easy way to do this is to set a System Restore point ( http://www.microsoft.com/windowsxp/using/h...temrestore.mspx )

Next, go to Start...Run...and type in "regedit.exe" (without the quotes) and press enter. You'll see a folder-like view on the left, and entries on the right.

Navigate down the folder view on the left to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\Setup Just click on the + sign to expand the view of the next level - so, to start, you'll click on the + next to HKEY_LOCAL_MACHINE and look for the SOFTWARE entry.

Then you'll click on the + next to SOFTWARE and look for Microsoft, and so on until you get to the Setup key. Then just click once on the Setup key.

Look in the right hand pane and double click on the entry that says "SourcePath".
In the box that pops up, type in "C:\" (without the quotes) and press Enter. Then close regedit and reboot your computer. SFC.EXE /SCANNOW should now run without problems for you.
___________________________________________________________________________
If you're unable to find the i386 folder, it may be that it's on a hidden partition on your hard drive or that the restore CD has been created in a different way and you can't view the directories.

If so, there's a couple of more things to try (please post your question in the forums) or you can look to see if your system has a repair or a non-destructive recovery option. This option will leave your programs and data intact while replacing all of the Windows files. This is also the next step if SFC.EXE /SCANNOW doesn't fix the problem.

Edited by usasma, 05 October 2006 - 08:15 AM.

My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

#3 lucas

lucas

  •  Avatar image
  • Members
  • 47 posts
  • OFFLINE
  •  
  • Local time:09:27 AM

Posted 07 October 2006 - 10:53 AM

I followe this instructions:
Next, go to Start...Run...and type in "regedit.exe" (without the quotes) and press enter. You'll see a folder-like view on the left, and entries on the right.

Navigate down the folder view on the left to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\Setup Just click on the + sign to expand the view of the next level - so, to start, you'll click on the + next to HKEY_LOCAL_MACHINE and look for the SOFTWARE entry.

Then you'll click on the + next to SOFTWARE and look for Microsoft, and so on until you get to the Setup key. Then just click once on the Setup key.

Look in the right hand pane and double click on the entry that says "SourcePath".
In the box that pops up, type in "C:\" (without the quotes) and press Enter. Then close regedit and reboot your computer. SFC.EXE /SCANNOW should now run without problems for you.

BUT IT DID NOT FIX THE PROBLEM. IS THERE ANYTHING ELSE I CAN DO ?

#4 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad

  • Topic Starter

  •  Avatar image
  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:10:27 AM

Posted 08 December 2006 - 09:18 AM

Hi Lucas!

This is the first time that I've looked back at my mini-guide on using SFC.EXE and just noticed your post from Oct 7.

My apologies for not seeing this sooner, but the mini-guide forum isn't routinely monitored. If you're still experiencing problems, please post your problem at: http://www.bleepingcomputer.com/forums/ind...hp?showforum=56

- John
My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

#5 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad

  • Topic Starter

  •  Avatar image
  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:10:27 AM

Posted 01 April 2007 - 07:14 AM

SFC.EXE uses the C:\Windows\system32\dllcache folder to replace changed files. It also uses a log file that I haven't been able to locate (although there should be entries in the Event Viewer that describes each change). EDIT: Here's how to analyze the logfiles in Vista: http://support.microsoft.com/kb/928228

There's (according to Microsoft) approximately 2,700 files that are protected. On my XP installation there's 2,511 files in the dllcache folder (so I'm missing almost 200). (see Post #8 for the list for SP3 - 3588 files).

Previously I've been of the opinion that explorer.exe wasn't protected - this ISN'T the case. It is protected.

SFC.EXE also protects the drivers contained in the drivers.cab file - but it should do this silently - but I'll need to do more research on it.

Optimizing Windows File Protection Service: http://support.microsoft.com/kb/229656

Edited by usasma, 10 May 2008 - 10:02 AM.

My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

#6 dirtfarmer

dirtfarmer

  •  Avatar image
  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:09:27 AM

Posted 16 December 2007 - 01:07 PM

but i have a question what happen when you what to use sfc /scannow, and go to registry to change seting there so you do not need the xp cd any more

but find out on how to do it, ther is no SourcePath lisyted in registy


i have use sfc /scannow for a long time, with a home xp cd before sp1,, but i got a new compter with xp home sp2 cd,, and SourcePath is not there

#7 usasma

usasma

    Still visually handicapped (avatar is memory developed by my Dad

  • Topic Starter

  •  Avatar image
  • BSOD Kernel Dump Expert
  • 25,091 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Southeastern CT, USA
  • Local time:10:27 AM

Posted 10 May 2008 - 09:59 AM

Just a bit more info. I found out from Windows Internals, 4th Edition that the sfcfiles.dll file has the list of files that SFC.EXE scans for (you can view it with the Strings utility from SysInternals - but will have to pipe it to a text file because the output quickly overflows the available buffers in cmd.exe).

In my slightly customized Virtual Machine with SP3 installed, the list of files totals 3585 (changed from Post #5). This is after subtracting all the duplicates (about 4 for each file) and the "gibberish" that I didn't understand. So, it's safe to say that SFC.EXE scans at least 3585 files when it's working. Most of the files are .dll's, and most are located in the System32 sub-directory - but there's a lot that don't fit this rule.

BTW - this file doesn't seem to exist in Vista - so it'll take some more research on my part to figure out where it is now. :huh:

Edited by usasma, 10 May 2008 - 10:15 AM.
added Vista info

My browser caused a flood of traffic, sio my IP address was banned. Hope to fix it soon. Will get back to posting as soon as Im able.

- John  (my website: http://www.carrona.org/ )**If you need a more detailed explanation, please ask for it. I have the Knack. **  If I haven't replied in 48 hours, please send me a message. My eye problems have recently increased and I'm having difficult reading posts. (23 Nov 2017)FYI - I am completely blind in the right eye and ~30% blind in the left eye.<p>If the eye problems get worse suddenly, I may not be able to respond.If that's the case and help is needed, please PM a staff member for assistance.

#8 hifrmny

hifrmny

  •  Avatar image
  • Members
  • 20 posts
  • OFFLINE
  •  
  • Local time:10:27 AM

Posted 27 August 2008 - 09:28 AM

There's (according to Microsoft) approximately 2,700 files that are protected. On my XP installation there's 2,511 files in the dllcache folder (so I'm missing almost 200). (see Post #8 for the list for SP3 - 3588 files).


I run XP Pro sp2 and in my dllcache folder, there are 2953 files. That's quite a bit above the 2700 you stated. I wonder why I have so many extras...

#9 garmanma

garmanma

    Computer Masochist


  •  Avatar image
  • Helper Emeritus
  • 27,809 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Cleveland, Ohio
  • Local time:10:27 AM

Posted 27 August 2008 - 05:51 PM

I run XP Pro sp2 and in my dllcache folder, there are 2953 files. That's quite a bit above the 2700 you stated. I wonder why I have so many extras...

It's been a year since that statement. With updates and SP3 it's now more

with SP3 installed, the list of files totals 3585


Mark
Posted Image
why won't my laptop work?

Having grandkids is God's way of giving you a 2nd chance because you were too busy working your butt off the 1st time around
Do not send me PMs with problems that should be posted in the forums. Keep it in the forums, so everyone benefits
Become a BleepingComputer fan: Facebook and Twitter

#10 Billy O'Neal

Billy O'Neal

    vcpkg Maintainer


  •  Avatar image
  • Malware Response Team
  • 12,305 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:07:27 AM

Posted 30 August 2008 - 12:35 AM

Hello, all :huh:

If you run Windows XP SFC and it asks for your "Service Pack 3 Disk", you can extract the service pack 3 files as follows:

Download the standalone windows XP SP3 package from here:
http://www.microsoft.com/downloads/details...;displaylang=en
and save it to your desktop.

Then extract the files from the package by going to Start -> Run and entering:
"%userprofile%\Desktop\WindowsXP-KB936929-SP3-x86-ENU.exe" -x:C:\xpsp3
This will place the service pack 3 updates to the i386 folder into your C drive under the folder "xpsp3".

You should then be able to point SFC at this folder for the files it can't find from your windows disk or i386 folder.

Hope that helps,
Billy3

#11 cmstormer

cmstormer

  •  Avatar image
  • Members
  • 1 posts
  • OFFLINE
  •  
  • Local time:09:27 AM

Posted 04 December 2008 - 11:19 PM

There have been some issues with running SFC.EXE /SCANNOW that this article doesn't address. They are:
1) The system won't accept the original installation disk because it doesn't have Service Pack 2 on it.
2) You don't have a Windows installation CD - only a restore CD from the manufacturer.

Here's how to deal with them:
__________________________________________________________________________

To fix the SP2 issue, you'll have to "slipstream" SP2 along with your installation CD. Rather than going through all the gory details here, just visit this link: http://www.winsupersite.com/showcase/windo..._slipstream.asp It provides a detailed explanation of how to slipstream SP2 along with your Windows installation CD.
__________________________________________________________________________

To fix the problem when you only have a restore CD you'll have to search for a folder on your hard drive (or on the restore CD) that's named "i386" (without the quotes). Once you find that, copy it to your hard drive at the root (C:\i386). Make sure that the directory is located at the root of your C: drive (C:\i386) - if not, then you'll need to change the path to the proper entry in the registry edit.

Then perform this registry edit to point SFC.EXE at it:

So, the first step is to backup your registry. The easy way to do this is to set a System Restore point ( http://www.microsoft.com/windowsxp/using/h...temrestore.mspx )

Next, go to Start...Run...and type in "regedit.exe" (without the quotes) and press enter. You'll see a folder-like view on the left, and entries on the right.

Navigate down the folder view on the left to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\Setup Just click on the + sign to expand the view of the next level - so, to start, you'll click on the + next to HKEY_LOCAL_MACHINE and look for the SOFTWARE entry.

Then you'll click on the + next to SOFTWARE and look for Microsoft, and so on until you get to the Setup key. Then just click once on the Setup key.

Look in the right hand pane and double click on the entry that says "SourcePath".
In the box that pops up, type in "C:\" (without the quotes) and press Enter. Then close regedit and reboot your computer. SFC.EXE /SCANNOW should now run without problems for you.
___________________________________________________________________________
If you're unable to find the i386 folder, it may be that it's on a hidden partition on your hard drive or that the restore CD has been created in a different way and you can't view the directories.

If so, there's a couple of more things to try (please post your question in the forums) or you can look to see if your system has a repair or a non-destructive recovery option. This option will leave your programs and data intact while replacing all of the Windows files. This is also the next step if SFC.EXE /SCANNOW doesn't fix the problem.


Just a note to add that if you're using an Operating System disk from your computer's manufacturer, it likely will open a pop-up screen upon insertion, which asks what you want to do. Minimize it or wait for SFC's scan progress box to return to the forefront. Having used these disks with SFC on at least four different computers, I found that the disk required reinsertion a couple of times, apparently to allow SFC to get far enough into the files to locate useful ones. It hurts nothing to remove and reinsert the disk until SFC 'latches on' and proceeds normally. Remembering the first experience and wasted time, I wished someone had forewarned me about this! - cmstormer

Edited by cmstormer, 04 December 2008 - 11:43 PM.


#12 lowtek_otc

lowtek_otc

  •  Avatar image
  • Members
  • 280 posts
  • OFFLINE
  •  
  • Local time:09:27 AM

Posted 10 January 2009 - 04:54 PM

Hello, all :huh:

If you run Windows XP SFC and it asks for your "Service Pack 3 Disk", you can extract the service pack 3 files as follows:

Download the standalone windows XP SP3 package from here:
http://www.microsoft.com/downloads/details...;displaylang=en
and save it to your desktop.

Then extract the files from the package by going to Start -> Run and entering:

"%userprofile%\Desktop\WindowsXP-KB936929-SP3-x86-ENU.exe" -x:C:\xpsp3
This will place the service pack 3 updates to the i386 folder into your C drive under the folder "xpsp3".

You should then be able to point SFC at this folder for the files it can't find from your windows disk or i386 folder.

Hope that helps,
Billy3


Um, wont this just create a folder on the root. ... C:\xpsp3 when we are trying to make the folder a sub-directory of the i386 folder (C:\i386\xpsp3) ??????

#13 DaChew

DaChew

    Visiting Alien


  •  Avatar image
  • Members
  • 10,317 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:millenium falcon and rockytop
  • Local time:10:27 AM

Posted 12 February 2009 - 07:07 AM

C:\WINDOWS\ServicePackFiles\i386

After applying the admin install of SP3 for windows xp, I have a i386 folder with 561 MB and 2,949 files

:huh:

What was microsoft's intention here?
Chewy

No. Try not. Do... or do not. There is no try.

#14 Zeroshin

Zeroshin

  •  Avatar image
  • Members
  • 11 posts
  • OFFLINE
  •  
  • Local time:10:27 AM

Posted 07 May 2009 - 08:34 AM

I ran the Sfc.exe file to try and recover windows files, however I am still missing many of them. I got a pretty bad virus and I'm not sure what the name of it is...I think it was one released in april...not sure, it has caused my task bar not to allow files to minize in it, my windows media player gives me a memory error, and my CD drive will not show up...Also windows scripting and system restore are messed up...I don't know how to fix it...I've tried registry cleaner things, I've tried virus scanning (Norton 360) never got anywhere. This may be the wrong board to be requesting help...but...I thought Sfc was supposed to tell you if windows files have been modified.

#15 Billy O'Neal

Billy O'Neal

    vcpkg Maintainer


  •  Avatar image
  • Malware Response Team
  • 12,305 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:07:27 AM

Posted 19 July 2009 - 06:47 PM

Just a bit more info. I found out from Windows Internals, 4th Edition that the sfcfiles.dll file has the list of files that SFC.EXE scans for (you can view it with the Strings utility from SysInternals - but will have to pipe it to a text file because the output quickly overflows the available buffers in cmd.exe).

In my slightly customized Virtual Machine with SP3 installed, the list of files totals 3585 (changed from Post #5). This is after subtracting all the duplicates (about 4 for each file) and the "gibberish" that I didn't understand. So, it's safe to say that SFC.EXE scans at least 3585 files when it's working. Most of the files are .dll's, and most are located in the System32 sub-directory - but there's a lot that don't fit this rule.

BTW - this file doesn't seem to exist in Vista - so it'll take some more research on my part to figure out where it is now. :huh:

http://billy-oneal.com/SFCDump.exe <-- Have fun :huh:




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users