By Ivy / Last update August 29, 2022

How do I repair Windows 10/11 with command prompt?

When there is some problem happening to Windows, you can repair your windows with some basic repair like Windows directory repair, boot directory repair. When the error is too serious, you can run advanced repair like system restore. For Windows 10/11, you can also use DISM command line utility to repair Windows 10/11 image.

Repair Windows 10 using Command Prompt

Next, this article will introduce you how to repair Windows 10/11 using command prompt with five methods. Note that you can easily open cmd if the Windows loads normally. If not, you cannot open cmd as before. In this case, try the following methods:

#1: Enable safe mode with command prompt. In Windows 10/11, hold the Shift button and click Restart, then select 6 or use F6 to enable command prompt under safe mode. Or shutdown your computer completely and restart, then hold the Power button when it start to load Windows. Repeat this process 3-4 times and select the option to enable command prompt. 

Select Command Prompt

#2: Access command prompt from the recovery environment. In Windows 10/11, click Start > Settings > Update & Security > Recovery > Advanced startup and then Restart now to boot into recovery environment. And then, click Troubleshoot > Advanced options > Command Prompt or directly press Shift + F10 to summon it. 

If you cannot access Windows 10/11, insert installation media, set boot priority for it and boot into recovery environment, then select command prompt in the Advanced options window.

Advanced Options

Method 1. How to repair Windows 10/11 using SFC

SFC (System File Checker) is a command-line utility that can scan for corruption in Windows system files and replace any corrupted or missing protected system files with a known good version. When you feel buggy with your computer or notice problems during boot, you can use SFC to diagnose problems and repair it. 

To repair Windows 10/11 using SFC with detailed steps:

1. Open "Start", search for the Command Prompt, select it and run as administrator.

2. Then type the command: "sfc /scannow" and press "Enter".

SFC

If SFC is unable to fix the problem, probably the utility cannot get the necessary files from the Windows image, which might have become broken. In this situation, you can use DISM to repair the Windows image.

Method 2. How to repair Windows 10/11 using DISM

Windows 10/11 includes a command-line utility known as DISM (Deployment Image Servicing and Management). DISM command Windows 10/11 can be used to repair and prepare Windows images, including, Windows Setup, Windows Recovery Environment, and Windows PE. Also, DISM can be used to fix the recovery image within an installation of the operating system.

To repair Windows 10/11 using DISM commands:

  • To check whether there is any corruption, Run command line as administrator, then type the following syntax and press "Enter".

DISM /Online /Cleanup-Image /CheckHealth

  • To scan the Windows image for any corruption, type below command and hit "Enter".

DISM /Online /Cleanup-Image /ScanHealth

  • To fix Windows image, type the following command and hit "Enter".

DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\install.wim

DISM Repair Windows 10

Method 3. How to reset Windows 10/11 with command line

If you are not sure why your computer run into issues, it's a good choice to reset your PC in Windows 10/11. It will keep your personal data and remove all apps and programs, except for preinstalled software. For more infomation, click Reset Windows 10 PC and keep my files

To reset Windows 10/11 with "Reset this PC", follow the instructions below:

Type “systemreset -cleanpc” in an elevated command prompt and press "Enter".  (If your computer cannot boot, you can boot into recovery mode and select "Troubleshoot", and then choose "Reset this PC".)

Reset PC

Method 4. How to run system restore with command prompt

If the problem is too severe, you can try to restore your Windows 10/11 to the previous state as long as you have enabled System Restore feature. But, it will not restore documents, music, emails, or personal files of any kind, so you need to backup files to external drive before performing system restore. If this is what you need, see below.

To run system restore in safe mode, follow the steps below:

1. If your computer can boot normally, start cmd as before. If not, start your computer from safe mode and enable command prompt via 6 or F6. 

2. Sign in using an administrator account if needed. Once the command prompt is showing, enter "rstrui.exe" at first in the Command Prompt Window and press "Enter" to continue.

Launch System Restore

3. This command will bring you to the interface of System Restore. Click Next and then choose to use the recommended restore point or a different restore point. Afterward, follow the instructions.

System Restore Next

Method 5. How to restore Windows 10/11 using AOMEI.exe (Universal)

The above methods are very convenient and can help you in certain situations, for example, the system files are damaged, or corrupted backup image, update or driver issues, etc. But if your system crashes or the hard disk is damaged, you need one more professional way to repair Windows 10 or 11. It's worth trying a reliable backup and restore software - AOMEI Backupper Professional.

It allows you to backup and restore system with command line or graphic user interface. And you can benefit from its useful features, for example, you can use AOMEI Backupper to create incremental/differential backup that backup only changes, and you can restore system to dissimilar hardware

Download the 30-day free trial of AOMEI Backupper right now! Windows 11/10/8/7/XP/Visa are supported.

Download Free Trial Win 11/10/8.1/8/7/XP
Secure Download

Suppose you have created system image backup with AOMEI Backupper. Before restoring system, you can use the Check Image feature to check if system image backup is intact and without error. Also, you need to learn some parameters you will use, please type "ambackup /?" at the command prompt window to get them. 

Backup Command

Then, use the following steps to restore Windows 10/11 using command prompt (here is AOMEI.exe):

1. Navigate to AOMEI Backupper installation directory by typing the following command in command line and press "Enter". For example: cd C:\Program Files (x86)\AOMEI Backupper.

Note: If you run this command under Windows PE environment, the drive letters might change.

2. Run the following command to start restore: AMBackup /r /t [backup type] /s "[backup location path]" /d [destination location]. For example: To restore the system backup saved in J:\systembackup1 to disk 1. You should type the command: AMBackup /r /t system /s “J:\system backup\systembackup1.adi” /d 1.

AOMEI Command

Tips:

  • If you need to restore to another computer, AOMEI Backupper "Universal Restore" feature can make this very easy. For example: Run system restore in the image named "systembackup1.adi" to the partition 0 on disk 0 and perform a universal restore. AMBackup /r /t system /s "D:\system backup\systembackup1.adi" /d 0:0 /x.
  • You can access this software quickly without booting the computer by its "Recovery Environment" utility.

Except for the command line interface, you still can use its graphic user interface and the steps are easier. It requires a backup image and be sure it's intact too. Note that if you cannot access your computer, you still need to create a bootable USB (16GB at least) on a working computer. 

Select Task

Then, follow the steps below to repair and restore Windows 10 easily:

1. Launch this software, go to Restore tab and choose Select Task

2. In the Restore window, select the backup image you want to restore, here is system backup, and click Next. 

System Restore

Tip: If there is no system image, you can choose to select backup image manually. Click Back and then choose Select Image File to browse and select image.

3. In the image information window, choose Restore this system backup and Restore system to other location. Then, click Next and select the new hard drive in the next window. 

Restore This System Image

4. Preview the operation summary and click Start Restore

Tips:

Summary

Now you have learned how to repair Windows 10/11 using command line with five methods. You can choose one based on your preference. It is also suggested to keep backup software AOMEI Backupper installed on your computer to provide continuous protection. 

If you want to protect unlimited computers within your company or deploy images to multiple computers effortlessly, you can pick AOMEI Backupper Technician or TechPlus edition. You will be surprised to find that it enables you to copy the installation directory for portable version creation and then use it on any computer. Don't hesitate to try it out!