How to repair system with Windows 11 Command Prompt
To restore the Windows 11 system, you can use the [sfc /scannow] and [Dism] commands at the command prompt to check and repair system files and system images. Also, if Windows 11 is running, you can do the same with “Terminal” This page introduces how to restore the system with the command prompt separately from the state when Windows 11 is started and the “repair function” when Windows 11 is not started .Please refer to the following page for how to repair the file system related to the disk drive and how to check disk.
■ Windows 11 is not started
- Repair system with command prompt of repair function
- (Repair function) Confirmation operation before repair
- (Repair function) Repair system files
- (Repair function) Repair system image
1. Launch Command Prompt
- After pressing the “Windows” key on your keyboard, press ” cmd “.
- When the search screen appears, click “Run as administrator” in Command Prompt.
*This operation is the same as entering “cmd” in the search.
To start from the Start menu, click “All apps” and click “Windows Tools” in the list to open Explorer, right-click “Command Prompt” and select “Run as administrator” “Click
2. Repair system files
Type sfc /scan now and press Enter on your keyboard.
It will start checking and repairing system files. It may take some time depending on the environment, but wait until it finishes. end of command
- Successful completion:
The screen displays “(…, no integrity violations were detected.) No corrupted system files were detected” or “…successfully has been repaired.” is displayed.
*The figure below shows the screen where the problem was detected and the repair is completed.
*The figure below shows the screen where no problem was detected. - Unsuccessful completion:
The screen displays “… was not repaired” or “… operation could not be performed”.
- If the restoration is not completed successfully, execute “Repair System Image” in the next section.
- If it ends normally but the problem is still not resolved, start the command prompt again and execute “Repair system image” in the next section.
3. Repair system image
The “Dism Online” command allows you to restore the system image using data from the cloud (Internet).
Check system image
Type Dism /Online /Cleanup-Image /ScanHealth and press Enter on your keyboard.
This task may take quite some time, so just wait until it finishes.
* Don’t forget the blanks.
Dism (blank) Online (blank)/Cleanup-Image (blank)/ScanHealth
If there is an error in the blank, an error will occur and execution will not be possible.When the check is complete and you see a message such as “…can be repaired” or “…corruption not detected” , then run a repair.
Restore system image from cloud
Type Dism /Online /Cleanup-Image /Restorehealth and press Enter on your keyboard.
The repair is complete when the message “Restore operation completed successfully” is displayed.
This completes the system image repair operation, but it will check the system files one last time. Run Check System Files Again
Run “Check System Files” again to complete system repair in Command Prompt.
Next, remove unnecessary system data. This is not required, but we recommend removing it.
4. Clean up system data
System data cleanup deletes unnecessary data, files, drivers, etc. due to updates, etc. Type Dism /online /cleanup-image /startcomponentcleanup and press Enter on your keyboard. This operation will take some time, but just wait until it finishes.
Cleanup is complete when you see “The operation completed successfully.”
Repair system with command prompt of repair function
To restore the system at the command prompt while Windows 11 is not running, check the drive letter (disk) in advance and restore the system.
1. (Repair function) Confirmation operation before repair
” in the command prompt and press “Enter” on the keyboard.
When File Explorer opens, click This PC.
- If “Reserved by system (C:)” and “Local disk (D:)” are displayed, the drive letter where Windows 11 is installed is “D: “ .
“offbootdir=C:\” path is “C”, so “offwindir=D:”. - If “System Reserved” is not listed, the path is ” C: “.
“offbootdir=C:\” path is “C”, so “offwindir=C:”. - If “System Reserved” is ” D: ” and your local disk is ” C: “.
“offbootdir=D:\” path is “C”, so “offwindir=C:”.
Just to be sure, check the contents of the disk.
Double-click the disk you want to check, and if there is a “Windows” or “Users” folder inside, you’re good to go.
After confirming, click the “x” close button to close Explorer and Notepad.
2. (Repair function) Repair system files
Type sfc /scannow /offbootdir=C:\ /offwindir= D: \windows and press Enter on your keyboard.sfc(blank)/scannow(blank)/offbootdir=C:\(blank)/offwindir= D: \windowsBe
careful with the space characters
Scanning and repairing will begin. It will take some time , but just wait.
End of Repair System File Check
- If “Failed to detect” is displayed, it means that the problem could not be detected.
- If “Could not repair” is displayed, the problem was found but could not be repaired.
- When “Repaired” is displayed, the problem has been detected and the system files have been repaired.
Even if “Restored” is displayed, execute “Repair system image” in the next section.
3. (Repair function) Repair system image
Scan system image
Type Dism /image: D: \ /cleanup-image /scanhealth and press Enter on your keyboard. “Beware of whitespace characters” This work will take quite a while, but wait until it finishes.
When the scan is complete, you will see something like “…can be repaired” or “…no damage detected.”
Regardless of what the message says, run System Image Repair next.
Repair system image
Type Dism /image: D: \ /cleanup-image /restorehealth and press Enter on your keyboard. This task can take quite some time, so just wait until it finishes.
The repair is complete when you see “Restore operation completed successfully”.
If an error occurs and cannot be repaired, go back to the beginning and try to repair by executing the “Repair system files” command. This completes the system image repair operation, but runs the system file check one last time.
If you run the first “system file check”, the system repair at the command prompt of the repair function is completed.