CMD Commands to Repair Windows
In today’s world, one cannot think of a computer without Windows 10 operating system. It is one of the fastest and is well optimized for almost every computer.
However, even Windows has its problems. We face a lot of irritating issues while using this OS. And since OS is the one that helps you in using your computer, a faulty OS can ruin your day entirely.
Nonetheless, Windows provides you with lots of troubleshooting and repair options to fix your damaged OS. Thus, instead of relying on someone, you can follow some steps to fix it yourself. All you need to know are a few code lines that you have to write on Command Prompt.
What is Command Prompt?
Command Prompt or CMD is a command-line interpreter for windows. It allows you to perform advanced administrative functions that you cannot do without any other software. To operate that, you will need to enter a specific code for a task that Windows will execute.
How to open Command Prompt?
There are multiple ways to open Command Prompt.
You can go to the start menu, and under the Windows System folder, you will see Command Prompt. Click that to open. To get complete administrative access, right-click on Command Prompt and press Run as Administrator.
You can also press the Windows button + R. This will open the Run dialog box. Type CMD in the bar. Press Ok to open CMD or press Ctrl + Shift + Ok to run CMD as an administrator.
Lastly, go to the search area of the start menu and type CMD. Press Enter to open CMD.
So here are the commands that you can use to repair your Windows.
Using SFC
Short for System File Checker, SFC is a command-line utility that scans for any corrupted or missing component in your system and replaces them with a good version. If you face any problems while using your OS or face problems while booting, you can use SFC as an immediate solution to your problem.
- Open CMD as Administrator
- Type the command: “sfc/scannow” and press Enter.
It takes some time to scan and fix the corrupt files depending on the system. Any minor issues are expected to be fixed by the time SFC has done its job. However, this is not the ultimate solution. Sometimes good files may not be available. For that, you will need to use DISM to repair the Windows image.
Repair Windows 10 using DISM
DISM, short form for Deployment Image Servicing and Management, is another command-line utility. This command is used to repair and prepare Windows images like Setup, Recovery Environment. You can also use DISM to fix the recovery image within the installation of OS.
To check for any corruption in the system files, the command is
DISM /Online /Cleanup-Image /CheckHealth
To scan windows image for any corruption, the command is
DISM /Online /Cleanup-Image /ScanHealth
To fix the Windows image, the command is
DISM/Online/Cleanup-Image/RestoreHealth/Source:repairSource\install.wim
Reset Windows 10 with command line
In case none of the above solutions work, you will need to reset your PC. Make sure that you take a backup of all your essential data.
Open CMD as an Admin and type “systemreset -cleanpc” and press Enter. In case your computer cannot boot, you can enter recovery mode. When in recovery mode, select “Troubleshoot”, there you will find an option to reset your PC.
Run system restore with Command Prompt
In case the problem is way too severe and none of the previous methods helped, you will need to restore your Windows 10 to its previous state as some of the installed programs or drivers may be responsible for this issue.
Please make sure that you take a backup of your personal files as you cannot restore them.
You will need to run your computer in safe mode to perform a system restore -
- Turn off your computer or restart it.
- As soon as you press the power button, press F8 on your keyboard repeatedly until the Windows advanced menu opens up.
- Click “Safe Mode with command prompt” and press Enter.
- Sign in as an administrator. When the command prompt text box appears, type “rstui.exe” and press Enter.
- A window will pop up, which is the interface of System Restore. Select “Recommended Restore” and follow the instructions given in the window.
Run CHKDSK to check for hard drive errors
One of the most common faults that cause Windows to crash or corrupt is a hard disc error. Check disc (chkdsk) will undoubtedly aid in the detection and repair of undesired disc issues on your HDD, particularly on your Windows 10 partition.
To run chkdsk, type the following command at the command prompt.
chkdsk c: /f
Since you’re not using your drive right now, chkdsk shouldn’t prompt you to restart your computer. If it says the volume is in use and that the chkdsk scan will be scheduled on your next restart, press the Y key to continue.
The scan, like the system file check, may take some time. Make an effort not to disrupt the scan. When the scan is finished, restart your computer to see whether your problem has been resolved. If the problem persists, proceed to the next repair instruction.
Run Bootrec to solve the issue of Boot in Windows 10
Bootrec.exe is a fantastic utility for fixing boot issues in Windows 10. If startup repair or any other troubleshooting fails to solve your Windows 10 boot problem, you should use the bootrec repair program.
Enter the below listed commands on the command prompt, followed by an Enter key after each command line.
bootrec /fixmbr</p> bootrec /fixboot bootrec /rebuildbcd bcdboot c:\windows /s c:
To solve the Master Boot Record (MBR) and other boot problems in Windows 10:
- Use these commands to run bootrec.exe.
- If your Windows 10 installation is on a different drive, replace C.
- After you've completed all of the commands, restart your computer.
If none of the techniques above fixes your Windows 10 boot problem, you can choose to restore Windows 10 to a previous date, roll back Windows 10 update to an earlier build, or reset Windows 10 to factory settings.
Other useful articles:
- Basic Windows CMD commands
- Cool CMD Commands Tips and Tricks
- Best CMD Commands for Hacking
- CMD Commands for Wireless Network Speed
- Useful Keyboard Shortcuts for CMD
- What Info about My Laptop Can I Check with CMD and How?
- Getting Started with CMD Windows
- TOP-12 Command-Line Interview Questions (Basic)
- Command-Line Interview Questions (Advanced)
- CMD Commands to Repair Windows
- CMD Commands to Speed Up Computer
- CMD Commands for MAC OS
- How Does the Command Line Work?
- MS-Dos Interview Questions in 2021
- Windows OS Versions and History
- Recent Windows Versions Compared
- Basic Windows Prompt Commands for Every Day
- Windows Command Line Cheat Sheet For Everyone
- Windows Command Line Restart
- Windows Command Line for Loop
- Windows Command - Change Directory
- Windows Command - Delete Directory
- Windows Command Line – Set Environment Variable