How to Fix System Files Using SFC, DISM and CHKDSK Automatic Batch File in Windows 10/11

How to Fix System Errors Using DISM, SFC and CHKDSK With Auto Batch file In Windows 10&11

Welcome everybody;

On this topic, you are going to learn how to repair all types of system errors by SFC, and DISM and CHKDSK using auto batch file in windows 10 or windows 11 computers.

This exclusive batch file will help you to check and then repair system errors by searching for corrupted or lost system files or bad disk sectors, which are the most common sources for blue and black screen errors, in windows 8, windows 10 and windows 11 operating systems.

It can be run online in running windows and in Safe Mode, or offline while booting into Advanced Windows Recovery Environment (WinRE). The options menu in the online mode is different than in the offline mode, so you will see four options in the online mode and 6 options in the offline mode. The batch script will detect the current boot mode and then show you the correct options menu automatically.


Online mode: Means that your computer is able to boot into windows desktop or into Safe mode, and you are able to login into your system normally, and is not mean that you are connected to the internet.

Offline mode: Means when the computer booted into Windows Recovery Environment (WinRE) or into Windows Pre-Installation Environment (WinPE).

First part: How to Run SFC, DISM and CHKDSK online in running windows?

  • To use the batch script online in running windows, do the followings:
    • Download the file from this link.
    • For best results, you can install the ISO file of windows 10 or windows 11 according to the installed windows in your computer.
    • Extract the downloaded zip file anywhere inside the computer,
    • Right-click the ISO file and then select Mount option.
    • Open the extracted folder.
    • Right-click the DISM-SFC-CHKDSK.bat and then select Run as Administrator option
    • Now, you can execute one of the shown options by typing the corresponding number into the batch window and then press Enter.
    • Let’s try to use the DISM command by typing one and pressing Enter
      • It will use the following commands to repair your system:
      • If you have a mounted ISO file of windows, the following command will be used:
        • The F is the letter of mounted ISO file
    • To use system files checker or SFC /ScanNow, type 2 and press Enter.
    • To check and repair the bad sectors or other corruptions on the disk, type 3 and press Enter to start checking process.
      • CHKDSK command can’t repair the disk corruptions while windows is running, so it will ask you if you want to schedule the task until the next restart.
    • Type Y or Yes and press Enter to start creating the task schedule.
    • Restart your computer so the CHKDSK can start scanning and repairing process.
    • If you want to use all tools at once, type 4 and press Enter.
    • If you have a mounted ISO file of windows, the batch script will use it as the repairing source for replacing or repairing the corrupted or missed system files. But if there is no mounted ISO file, the batch script will try to replace or repair the corrupted files locally from WinSxS folder automatically.

************ Note: The DISM and probably SFC may fail to repair the system files in running windows, so for best results, you have to run this batch file in offline mode by booting into Advanced Recovery Environment as you will see later. *************

How to fix Error 6801 and Error: 0x8000ffff of DISM?

If the DISM and or SFC fail in running windows with mentioned or another errors, you have to run the batch file in the offline mode by booting into Windows Recovery Environment (WinRE).

  • To boot into WinRE, do the followings:
    • Type CMD into Search box and then run the Command Prompt as Administrator
    • Type the following command and press Enter to check if the recovery Environment is enabled or not:
      • ReagentC /Info
    • If disabled, type the following command and press Enter to enable it:
      • ReagentC /Enable
    • Execute the ReagentC /Info again to confirm that the recovery enabled successfully.
    • If enabled, then restart your computer into Advanced Recovery Menu as followings:
      • Press and hold the Shift key from keyboard
      • Restart your computer while pressing the Shift key until you see Please Wait message.
      • Click on Troubleshoot and then select Advanced Options
      • After rebooting into Advanced menu, open the CMD and then watch what to do from the second part of this topic.

Second part: How to Run This Batch file Offline from Windows Recovery Environment?

As shown previously, you can restart your system while holding the Shift key down to boot into windows recovery menu, but if the system failed to start normally, you can do that by clicking Advanced options from Automatic or Start-up Repair blue screen, or by clicking See Advanced Repair Options from Recovery blue screen.

If the computer booted into a blue screen with “Your PC/Device Needs to Be Repaired” or “Your PC Couldn’t Start Properly” error messages, then press F1 or F2 or another key as shown in your screen to boot into advanced recovery menu.

If all these methods not working for you, then you have to make a bootable USB of windows using your mobile, by either using Windows recovery image only, or using a whole windows ISO file. However, if there is a severe system file corruption, then you have to use the second option so the DISM will replace or repair corrupted files from this ISO file of windows image.

  • Read this topic to learn how to create a bootable USB of whole Windows image in mobile.
  • Read this topic to learn how to create a bootable USB of Windows Recovery image only.
  • Read this topic to see how to boot from the Bootable USB into Windows Recovery Environment.

Note: You have to select the English as the keyboard language in order to be able to run this batch file.

  • Once you have booted into advanced Recovery Menu, you can open the Batch file as followings:
  • Open command Prompt
  • Type Notepad and press Enter
  • From File tab, select Open option
  • Click on This PC icon to show your storage partitions
  • Open the USB drive and then open the VMTechs-System-Repair folder
  • Change the File of Types option to All Files
  • Right click the batch file and select Run as Administrator
  • If there is no assigned letter to windows partition, you will encounter Windows partition can’t be found error message. To fix that, run Assign_Letters file as administrator and then try again.

How do I Repair Windows offline with DISM?

As you can see on the options list, there are two different ways to repair the system files using DISM.

In both options, the batch file will use DISM REVERTPENDINGACTIONS, STARTCOMPONENTCLEANUP, and RESTOREHEALTH commands to repair your system.

  • These are the DISM commands that will be used to fix your system problems:
  • If you are booting from a bootable USB of whole windows image, then the following command will be used:
      • %OSDRIVE%: Will be replaced by the letter of windows drive automatically
      • %WIMDRIVE%: Will be replaced by the letter of Windows Installation Media drive automatically

However, in the second option, the batch file will change the access permission to the system files, so the corrupted files will be replaced without errors. So try the option number one first, by typing one into the batch console and then press enter, as it takes shorter time than the second one. But if the first option failed, you have to try the second one by typing two and pressing Enter.

In both cases, the batch file will detect the Mounted image of Windows installation Media to use it as the source of repairing files.

If there is no mounted windows image, the DISM will try to repair the corrupted system files locally from the backup store of system files inside WinSxS folder.

But if the backup files are corrupted too or if there is no a new backup copy for the missing or corrupted file, then the DISM will probably fail to repair your issue. In this case, the bootable USB of whole Windows image is mandatory.

How to Run SFC Scan Now to Repair Windows 10 or Windows 11 Systems?

As on the DISM commands, there are two different options to repair system files using the System Files Checker or SFC command.

So to use the SFC Scan Now command directly, type three and press Enter. But if you encounter the Windows resource protection cannot perform the requested operation or another error, then you have to use the fourth option, so the batch file will enable Windows Module Installer Service by starting TRUSTED INSTALLER and change the security permissions using SECEDIT tools, after that, it will execute the SFC command automatically. The fourth option will take longer time at first time, but if the second option used and completed successfully, then the fourth option will skip the security permission step and then take shorter time.

If you have restarted the computer and want to try the DISM or the SFC tools with security modifications again, then delete the DONE.txt file from main directory of windows partition.

How to use CHKDSK to repair disk?

To repair disk error and bad sectors using CHKDSK command, type five and press Enter.

Unlike when using the CHKDSK online in running windows or in safe mode, in the offline mode you will not be asked to schedule the scanning task until next restart, because the windows partition is in use in running windows and can’t be scanned and repaired directly.

The Windows partition will not be accessible while the CHKDSK scanning is running.

How to repair system files and disk errors using SFC, DISM and CHKDSK together?

To run all three commands together, type six and press enter.

The batch file on this option will start checking and repairing system files using DISM command followed by SFC command, after that, it will use the CHKDSK to scan the disk for errors or bad sectors and repair them automatically.


To see how to use this auto batch file to fix boot failure or another system or disk errors by SFC, DISM and CHKDSK commands, then watch this video: