When critical Windows system files are missing or corrupted, some Windows features may stop working correctly or Windows may stop responding altogether. If this happens, you can use the Deployment Image Servicing and Management tool (DISM) and the System File Checker tool (SFC) to scan your system files and restore any corrupted or missing files.
Step 1: Run DISM
DISM provides the files required to repair your corrupted files. You should run DISM prior to running the System File Checker. To do this:
-
Open an elevated command prompt.
-
Type cmd in the Search box.
-
In the search results, right-click Command Prompt, and then select Run as administrator.
-
If you are prompted for confirmation or an administrator password, type the password, or click Allow.
-
-
In the Command Prompt window, type the following command and press Enter. It may take several minutes for the command operation to be completed.
DISM.exe /Online /Cleanup-image /Restorehealth
Tips:
-
DISM uses Windows Update as the source to provide the necessary files. However, if your Windows Update client is broken, you can use a running Windows installation, or a Windows side-by-side folder from a network share or removable media, such as the Windows DVD, as the source of the files. To do this, run the following command instead:
-
DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:C:\RepairSource\Windows /LimitAccess
-
In the above command, replace the C:\RepairSource\Windows placeholder with the location of your repair source. For more information about using the DISM tool to repair Windows, see Repair a Windows Image.
Step 2: Run System File Checker
In the Command Prompt window, type the following command, and press ENTER:
sfc /scannow
Warning: Do not close this Command Prompt window until the verification is 100% complete.
The sfc /scannow command will scan all protected system files and replace corrupted files with a cached copy. The scan results will be shown after this process is finished. You may receive one of the following messages:
Scan result message |
Corresponding action |
---|---|
Windows Resource Protection did not find any integrity violations. |
You do not have any missing or corrupted system files. |
Windows Resource Protection could not perform the requested operation. |
To resolve this problem, perform the System File Checker scan in safe mode. Make sure that the PendingDeletes and PendingRenames folders exist under %WinDir%\WinSxS\Temp. The %WinDir% placeholder represents the Windows operating system folder, such as, C:\Windows. |
Windows Resource Protection found corrupt files and successfully repaired them. |
The operation was successful. To view detailed information about the system file scan and restoration, go to How to view details of the System File Checker process. |
Windows Resource Protection found corrupt files but was unable to fix some of them. |
To repair the corrupted files manually, view details of the System File Checker process to find the corrupted file, and then manually replace the corrupted file with a known good copy of the file. |
More Information
To view the details included in the CBS.Log file, follow these steps to copy the information in the log to a viewable text file on your desktop:
-
Open an elevated command prompt, as described previously.
-
In the Command Prompt window, type the following command (on one line), and then press ENTER:
findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >"%userprofile%\Desktop\sfcdetails.txt"
Note: The Sfcdetails.txt file contains details from every time that the System File Checker tool has been run on the computer. The file includes information about files that were not repaired by the System File Checker tool. Verify the date and time entries to determine the problem files that were found the last time that you ran the System File Checker tool.
-
Open the Sfcdetails.txt file from your desktop.
-
The Sfcdetails.txt file uses the following format:
Date/Time SFC detail The following sample log file contains an entry for a file that could not be repaired: 2007-01-12 12:10:42, Info CSI 00000008 [SR] Cannot repair member file [l:34{17}]"Accessibility.dll" of Accessibility, Version = 6.0.6000.16386, pA = PROCESSOR_ARCHITECTURE_MSIL (8), Culture neutral, VersionScope neutral, PublicKeyToken = {l:8 b:b03f5f7f11d50a3a}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
After reviewing the log file to determine which system file was corrupted and could not be repaired, find where the corrupted file is located, and then manually replace the corrupted file with a known good copy of the file.
To do this, follow the instructions below. In the following commands, the <Path_And_File_Name> placeholder represents the path and the file name of the corrupted file.
Note: You may be able to get a known good copy of the system file from another computer that is running the same version of Windows as your computer. You may wish to perform a System File Checker process on that computer to make sure the system file that you intend to copy is a good copy.
Step 1: Take administrative ownership of the corrupted system file.
Type the following command in the elevated command prompt and then press ENTER:
takeown /f <Path_And_File_Name>
Example:
takeown /f C:\windows\system32\jscript.dll.
Step 2: Grant administrators full access to the corrupted system file.
Type the following command, and then press ENTER:
icacls <Path_And_File_Name> /grant administrators:F
Example:
icacls C:\windows\system32\jscript.dll /grant administrators:F
Step 3: Replace the corrupted system file with a known good copy of the file.
Type the following command, and then press ENTER:
Copy <Source_File> <Destination>
In the above command, replace the <Source_File> placeholder with the path and file name of the known good copy of the file on your computer, and replace the <Destination> placeholder with the path and file name of the corrupted file.
Example:
copy E:\temp\jscript.dll C:\windows\system32\jscript.dll
If the steps above don't work, you may need to reinstall Windows. For more info, see Recovery options in Windows.