The DISM command tool is a powerful Windows tool that can edit or repair Windows image files. If you are having issues with your system, you can run the DISM command to try and fix such errors. You can use the command prompt or the Windows Powershell to run DISM commands and fix your system.
However, some errors can completely make your PC unusable, restricting you from booting into Windows. In that case, you will have to boot into the Windows Recovery Environment and run the DISM commands from there.
How to Run DISM Commands to Repair Windows?
DISM stands for Deployment Image Servicing and Management. Although DISM has a variety of uses, this tool is commonly used to fix a malfunctioning Windows system. This is a command exclusive tool that needs to be run from thecommand prompt or the Powershell.
Using Command Prompt
To fix your Windows system, the DISM command is generally followed by switches that represent the target image, which can be either/Onlineor/Image. The/Onlineswitch will select your current running operating system as a target to fix, whereas/Imagewill allow you to specify another Windows image.
There is one mainstream command which we will use to repair Windows. There are a couple of other commands as well, which you can use to check for errors and repairability before repairing it.
DISM [target image] /Cleanup-Image [servicing_option] [servicing_parameter]
Online DISM
An online Windows image is the image that is currently in use to run the Operating system. When doing an online DISM with no servicing parameters, it takes files from previously downloaded Windows update components. However, if these update components are corrupt, it will download them again, which requires an internet connection.
But in case you don’t have internet to re-download the corrupt update components, you’re able to also specify another Image as the source. You can create and insert aWindows installation mediaand use it as the source.
Follow these steps to learn how to run an online DISM:
To use a specific Windows image as a source, use the following command:
DISM /Online /Cleanup-Image /RestoreHealth /source: <drive_letter>\sources\install /LimitAccess
Here, replace<drive_letter>with the letter of the drive containing the source image.
Offline DISM
While online DISM targets the current operating system, offline DISM targets a specific Windows image. You will have to specify the path to the partition that holds your operating system as the target image.
However, Offline DISM specifically requires a.wimfile as the source of repair. You can use the.wimin installation media, ISO file, or Windows Image File Format from different PC as a source for repair.
If you’re able to boot into your system, you may open the command prompt by following the above steps instead ofbooting into Windows RE.
Additional Commands
you’re able to also add special parameters to the DISM command. Adding parameters will execute the DISM command and the added parameter simultaneously. Here are a couple of parameters to consider:
If you want to learn about even more commands, you can checkMicrosoft’s official websitefor them.
Using PowerShell
Windows Powershell is another command line tool on your Windows PC. Although the Command prompt is common while running DISM commands, you can also use Powershell to run them. However, the commands for PowerShell are different from the command prompt. Follow these steps to run DISM commands from the PowerShell:
To run the DISM on an offline image, replace-Onlinewith the-path “\offline\Mount”.
Using Batch File
A batch file is an executable file that can run commands directly. They have a.batextension and can be created by using text editor software. you’re able to save this file in an easily accessible location and launch it whenever you have to run the DISM commands. Here are the steps to do it:
Launch the file by double-clicking it whenever you need to run the DISM command.