By Ivy / Last update December 5, 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 methods 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 from Command Prompt with five methods. Note that you can easily open cmd if the Windows loads normally. 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

1. Repair Windows 10 startup problems 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 fix Windows 10 startup problems. 

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 try the next solution.

2. Repair Windows 10 using DISM Command

Windows 10/11 includes a command-line utility known as DISM (Deployment Image Servicing and Management). DISM command in 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

3. Reset Windows 10 with command line to start over

If you are not sure why your computer run into issues, it's a good choice to reset your PC in Windows 10. 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 troubleshoot Windows 10 using command prompt in this way, 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

4. Run system restore with Command Prompt to fix Windows 10

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. Please note that it will not restore documents, music, emails, or personal files of any kind, so you need to backup files to external drive to avoid data loss before performing system restore. 

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

That's all common methods to repair Windows 10 problems or issues using Command Prompt. They are also suitable for Windows 11 and Windows 7 errors troubleshooting. 

However, prevention is better than cure. It is better to take preventive measures in advance than to solve the problem. Therefore, it is highly recommended to protect the Windows 10 with specialized software. 

With AOMEI Backupper Professional, you can easily backup or restore Windows 10 either in Command Prompt or friendly graphic user-interface. Once disaster occurs, like system crash or disk error, you may return to normal status in a short time. It also supports to restore Windows 10 to dissimilar hardware, i.e. a different computer.

5. How to restore Windows using AOMEI.exe command

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

Here are detailed steps to repair and restore Windows 10:

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. 

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. 

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're an IT Technician or 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 allows you to copy the installation directory for portable version creation and then you can use it anywhere and anytime. Don't hesitate to try it out!