This content is part of the Essential Guide: Windows 10 how-to guide

How to repair damaged or corrupt Windows system files

Windows system files are the lifeblood of the OS. Admins can use tools such as System File Checker and Deployment Image Servicing and Management to repair them when damaged.

To run properly, Windows operating systems depend on the Windows system files that make up the runtime environ...


With repeated use, Windows system files can be damaged or corrupted. Even though administrators may be tempted to replace a questionable or damaged installation with a clean runtime Server image, it is often a better idea to just repair Windows system files.

It comes down to the time and effort involved. Simple repairs can usually take five to 15 minutes. If it takes less time to replace a damaged image, then by all means, replace it. If not, admins should just repair Windows system files.

Repair tool No. 1: Windows System File Checker

The first repair tool to try is the System File Checker (sfc.exe). For admins looking for immediate scans of protected system files and attempting repairs for problem files, the proper syntax for sfc.exe is sfc /scannow.

If sfc.exe discovers an overwritten protected file, it retrieves the correct version of that file from the %systemroot%\system32\dllcache folder. A typical value for the %systemroot% environment variable is "C:\Windows." That translates into C:\Windows\system32\dllcache on most systems.

Sometimes, when the Windows System File Checker discovers files in need of replacement, admins must run the command more than once to replace them all. Obviously, this adds to the repair time.

The System File Checker can scan only with the /verifyonly option instead of /scannow. Running verify only with the sfc.exe command takes about the same time as running /scannow. As a result, using the /scannow switch every time is a reasonable choice.

Repair tool No. 2: DISM

Deployment Image Servicing and Management (DISM) is the Swiss army knife of Windows image maintenance. DISM is excellent for scanning and repairing damaged Windows system files if they also reside in the Windows Side by Side (WinSxS) folder.

DISM has two commands that are best for checking and repairing a Windows image: DISM /online /cleanup-image /checkhealth and DISM /online /cleanup-image /restorehealth [/Source:…].

With repeated use, Windows system files can be damaged or corrupted.

The first command checks the contents of the component store, which is located in the WinSxS folder and houses the tools for customizing Windows updates, for the OS against which it runs. It reports only "No component store corruption detected" or "Component store corruption detected." It's a simple Yes or No check on WinSxS. It's very fast, rarely taking more than 30 seconds to complete.

The second command replaces the corrupt files it finds with working versions. By default, it seeks to obtain these files from Windows Update on the internet. Admins can prevent it from using the internet with /limitaccess switch for DISM, which instructs the command to skip that step.

The best repair approach is to use the /Source switch to target a specific Windows image. The image may be a standard Windows Image file (WIM), such as those found in the various Windows ISO files available online from Microsoft, or a compressed Electronic Software Download (ESD) file, such as those used when downloading upgrades from Windows Update. It's important admins precisely match the image they're targeting with the /Source switch with the image they're repairing. Among other things, that means the same bits (x86/32-bit, or x64/64-bit), version number, build number and base OS language for the source as well as for its target.

The syntax for the /Source switch is a little arcane. This is the syntax diagram: /Source:<type>:<vol>:\<dirspec>\<imagefile>.<type>:<image-pos>
In use: /Source:WIM:X:\Sources\install.wim:1

Here's what those various fields mean or what they must contain:

  • <type>: Denotes the type of image file that acts as the source. Typically this is either WIM or ESD, a compressed version of WIM.
  • <vol>: The letter for the drive where the source image resides.
  • <dirspec>: The directory on the drive where the source image resides.
  • <imagefile>: The name of the image file where the source image resides.
  • <type>: The image file extension, usually .wim or .esd -- corresponds to the first item in this list.
  • <image-pos>: Some image files may include multiple images. This integer refers to the position in an image sequence. For most image files, this value is 1, but admins must still specify it. Multi-version image files contain two or more OS images.

The example above points to a Windows image file on the X: drive. That image file resides in the \Sources directory, is named install.wim and is the first image inside that file. In fact, this syntax is based on accessing a network share where the ISO for a current Windows Server image is mounted for ready access, which is common practice in many organizations.

Measuring the repair trade-off

Admins can figure out the time trade-off for attempting image repair rather than image replacement by running the various repair commands, and measuring typical completion times. Table 1 includes some average times for the commands, with variations to give admins some idea of what to expect. As is always the case with running systems: Actual system load and underlying system hardware cause these numbers to vary.

Table 1: Completion Time for Repair Commands, typical load (25-30% CPU, 50% RAM, 20-40% Disk)


Average Time (Minutes)

%-age variation

sfc /scannow



dism … /checkhealth



dism … /restorehealth



Note: times measured for systems not in need of repair; corrupted files will take time to copy and cause measured times to increase.

An effective rule of thumb is to double the numbers when attempting actual repairs. So admins make the repair/replace trade-off based on double the time they measure for a healthy system, as compared to the time required to roll in a new image for the OS in need of repair. That will let them know which way to turn when trouble rears its head, as it always does.

Next Steps

How to fix Windows 10 with an in-place upgrade

What to do about Wi-Fi problems after upgrading to Windows 10

A look at some common Windows 10 bugs

Dig Deeper on Windows 10