On this topic, you will learn how to fix most common errors of SFC and DISM tools when trying to fix corrupted system files in windows 11, windows 10 and windows 8.
DISM stands for Deployment Image Servicing and Management, and is an administrative tool used from command prompt to accomplish many tasks in windows operating systems, such as, repairing corrupted system files, adding or removing windows components or features, editing Windows images and many tasks.
On other hand, the SFC stands for System File Checker, and it is an administrative tool that can be used to check files integrity or to repair system files in windows.
Read this topic to see how to run DISM and SFC using auto CMD file without errors.
2.2.a. Once you have booted from the USB, check the WinSxS folder as followings:
2.2.a.1. Type NOTEPAD and press Enter
2.2.a.2. Click on “File” tab then select, “Open” option
2.2.a.3. Click on this PC
2.2.a.4. Open Windows partition then open Windows folder
2.2.a.5 Right-click on the WinSxS folder and select, Properties.
As you can see, there are only 1200 files inside the WinSxS folder in my corrupted system, however, it must be at least 51000 files, which are the minimum files in a newly installed Windows 10 or windows 11.
CHECKING WINDOWS EDITION, VERSION, BUILD NUMBER AND DEFAULT UI LANGUAGE IN BOTH INSTALLED WINDOWS AND IN USB:
2.2.b. To check windows edition, version, build number and default language of installed windows, do the followings:
2.2.b.1. Navigate to this path to check windows edition:
2.2.b.2. if there is a folder called professional, then the edition is Pro. For Windows 10 Enterprise you may have both Enterprise and Professional folders. In Home edition you will have only Home folder.
2.2.b.3. Back to command prompt and change CMD path to System32 folder:
CD /D D:\WINDOWS\SYSTEM32
2.2.b.4. Execute this command to identify windows version:
In my PC, the edition of windows is pro, the version is 2004, build number 19041, and the default language is en-GB.
So the bootable USB should contain windows 10 pro, with the same or newer version and build number.
With en-GB as a default language, in order to replace the missing files in my PC.
2.2.b.5. Now, check the version of windows in the USB drive using this command:
DISM /GET-WIMINFO /WIMFILE:H:\SOURCES\INSTALL.WIM
As you can see, the version and build number are the same of installed windows.
2.2.b.6. Because the edition of installed windows on the PC is pro, so I will select the index number 6 in the USB to show its info using this command:
2.2.c.3. Check the WinSxS files in the mounted folder.
Press shift+F10 keys from keyboard to open new CMD window
2.2.c.4. Use notepad to go to mount folder.
As you can see, there are 51085 files, which are the baseline required files for windows to boot and run normally, however, 2.2.c.5. the number of these files may be doubled in your computer due to windows updates, especially if there is enough free disk space and you didn’t configure windows to remove the older versions.
2.2.c.6. Create new folder inside system32 folder using this command:
2.2.c.7. Copy WinSxS folder to the created folder using this command:
This step is to make a backup copy for the existing WinSxS files, but before doing that, make sure you have enough free space on the windows partition, otherwise, delete unnecessary files or move them to external drive or to another partition in your computer if you have.
2.2.c.8. Now copy the files from MOUNT folder to WinSxS folder using this command:
/ZB : to use restartable mode; if access denied use Backup mode.
/XN : to eXclude Newer files.
/XC : to eXclude Changed files.
In my case, the existing files inside WinSxS folder where 1222 files only, so it takes about 16 minutes to copy new files, but it takes more than 15 hours to compare the sources files to the existing files before replacing or skipping them. So be patient, because it may take much more hours in your computer if you have more existing files.
2.2.d. If you can’t wait for this long process, you can try to rename your existing WinSxS folder, then copy the whole WinSxS folder from mount folder to Windows folder as followings:
2.2.d.1. Rename the WinSxS folder in your windows folder using this command:
REN D:\WINDOWS\WinSxS WinSxS.original
This step is to replace making a backup as on step number 2.2.c.7.
2.2.d.2. Then create new folder and name it WinSxS using this command:
2.2.d.3. After that, copy all WinSxS files and folders from mounted folder into new WinSxS folder using this command:
2.2.d.4. Finally, execute the DISM and SFC commands again, or boot to your windows to see if the issue fixed or not.
2.2.e.1. If the issue not fixed, you have to use ROBOCOPY command to add the missing files. But before doing that, remove new WinSxS folder (if you have tried the previous command in step number 2.2.d.1) using this command:
RMDIR D:\WINDOWS\WINSXS\ /S
2.2.e.2. Then restore your original WinSxS folder using this command:
REN D:\WINDOWS\WinSxS.original WinSxS
2.2.e.3. After that execute the ROBOCOPY command and wait for it until complete.