You repair the MBR from Command Prompt by booting Windows Recovery Environment (WinRE) or installation media, opening a command prompt, and running bootrec commands in sequence—typically /fixmbr, then /fixboot, /scanos, and /rebuildbcd, finishing with bootsect /nt60 SYS. The key condition: this works for standard Master Boot Record (MBR) disks on BIOS or legacy-boot systems. If your machine uses UEFI with a GPT disk, the MBR repair commands are the wrong tool entirely, and you'd instead rebuild the EFI System Partition boot files.

That distinction matters more than most guides admit. Running bootrec /fixmbr on a GPT/UEFI system won't usually destroy data, but it also won't fix anything, and you can waste an hour chasing the wrong layer of the boot chain. So before touching a single command, confirm what you're actually dealing with.

First, Confirm You Actually Have an MBR Problem

The Master Boot Record is the first 512 bytes of an MBR-partitioned disk. It holds a tiny bootstrap loader and the partition table. When it's corrupted—by an interrupted update, a rogue bootloader from a second OS, malware, or a failing drive—the symptom is usually one of these:

"Operating system not found," "Missing operating system," or "Invalid partition table" on a black screen. A blinking cursor with no boot. "Bootmgr is missing" or "BOOTMGR is compressed." The machine drops straight into BIOS/UEFI setup or a PXE network boot.

Now the fork in the road. If your system boots via UEFI (most PCs built after roughly 2012, and essentially all modern ones), it almost certainly uses a GPT disk with an EFI System Partition—not an MBR. You can check from within a working Windows install by opening Disk Management (diskmgmt.msc) and right-clicking the disk: a "Convert to GPT Disk" option means it's currently MBR; a "Convert to MBR Disk" option means it's GPT.

If Windows won't boot at all, you can't check from Disk Management. Instead, note your firmware mode: if the boot menu or setup screens mention "UEFI" alongside the drive, you're on UEFI. For UEFI/GPT systems, skip the bootrec /fixmbr path and go to the UEFI-specific section below.

One more precondition: back up what you can before proceeding. MBR repair commands are generally non-destructive to partitions, but diskpart clean (which some guides suggest far too casually) wipes the partition table. If the drive holds the only copy of something important and it's physically failing—clicking, not detected intermittently—stop and consider professional data recovery before writing anything to the disk.

Get Into a Command Prompt You Can Actually Use

You can't run repair commands from a Windows that won't boot, so you need an external environment. There are two reliable routes.

Route A: Windows Recovery Environment (WinRE). On a PC that fails to boot, Windows often tries to enter recovery automatically after a couple of failed starts. If it does, choose Troubleshoot, then Advanced options, then Command Prompt. If it doesn't, interrupt the boot two or three times in a row (power off during the spinning-logo phase) to trigger automatic repair.

Route B: Installation media. Create a Windows USB installer on another working PC using Microsoft's Media Creation Tool. Boot from it, choose your language, and on the setup screen click "Repair your computer" (lower-left) rather than "Install now." Then navigate Troubleshoot, Advanced options, Command Prompt.

Either way you land at an X:\Sources> prompt, where X: is a temporary RAM disk—not your Windows drive. That's the single most common source of confusion. Your real Windows installation is usually C: in this environment, but it can shift to D: or E: depending on how many partitions and drives are attached. Confirm it before running anything drive-specific.

At the prompt, type:

Read the volume list. Look for the volume labeled with your Windows letter and a size matching your system drive (typically tens or hundreds of GB). Note the letter. If it's not C:, substitute your actual letter in every command below. As a cross-check, dir C:\ should show Windows, Program Files, and Users folders—if it doesn't, you've got the wrong letter.

This is your success check before proceeding: you're at a command prompt, and you've positively identified the drive letter holding your Windows folder.

Run the Bootrec Repairs in the Right Order

The bootrec utility is the standard Windows tool for repairing boot records. Run these from the recovery command prompt, one at a time, reading the result of each before moving on. The order below goes from least to most invasive.

  1. bootrec /fixmbr — Writes a standard, clean master boot record to the system disk. This overwrites the MBR boot code without touching the partition table. Expected output: "The operation completed successfully." If it says "This operation may not be supported on this disk" or references GPT, that's your signal you're on the wrong disk type—stop and reassess.

  2. bootrec /fixboot — Writes a new boot sector to the system partition. Expected output: "The operation completed successfully." On some systems, especially with certain update levels, this returns "Access is denied." That's a known quirk rather than a dead end; the bootsect command below is the alternative. Don't panic if it fails—just proceed.

  3. bootrec /scanos — Scans all disks for Windows installations and lists them. You want to see your installation appear here. If it finds nothing, the problem may be deeper than the MBR—possibly a corrupted BCD store or a disk Windows can't read properly.

  4. bootrec /rebuildbcd — Scans for installations and lets you add them to the Boot Configuration Data store. If it finds your Windows install, it prompts "Add installation to boot list? Yes/No/All." Type Y. This step is often what actually restores a working boot when the BCD—not the MBR—was the real problem.

If /rebuildbcd reports "The requested system device cannot be found," the BCD store itself may be missing or unwritable. The fix is to clear the old store and rebuild it explicitly:

The attrib command clears the hidden, read-only, system attributes so you can rename the store; ren moves the damaged BCD aside; the rebuild then creates a fresh one. If Windows lives on a separate hidden System Reserved partition (common on older MBR setups), the BCD path might be on that partition's letter instead—check dir of any small ~100–500 MB volumes from your earlier list volume.

  1. bootsect /nt60 SYS /mbr — As a follow-up, this rewrites the boot sector with the BOOTMGR-compatible version and, with the /mbr switch, updates the MBR too. Use SYS to target the system partition. This is the standard alternative when /fixboot throws "Access is denied."

Success check: after running these, type exit to leave the command prompt and choose "Continue" or restart. If the repair worked, Windows boots normally. If you still get the same error, don't loop endlessly—move to the diagnostics below.

When Bootrec Fails: Reading the Errors

Failures here are informative rather than random, and each points somewhere specific.

"Access is denied" from /fixboot. This is the most commonly reported issue. It usually means the boot sector is locked or the target volume letter is wrong. Try running from the X:\Sources prompt with the correct system partition, or use bootsect /nt60 SYS /mbr as the substitute. Booting the installation media in legacy/BIOS mode rather than UEFI mode (if your firmware supports both) sometimes clears it too.

"Element not found" from /rebuildbcd. The BCD store location can't be resolved. Make sure you've identified the true system partition—the small active one, not necessarily the large Windows volume. Run diskpart, then list volume, and look for the volume marked "System" or "Active."

Nothing found by /scanos at all. If no Windows installation appears, the recovery environment may not be reading the disk—a sign of a failing drive, a partition table so damaged the volume won't mount, or a mismatched disk type. Don't keep hammering bootrec. Instead confirm the disk is visible with diskpart → list disk. If it shows up as "Unknown" or with wrong size, treat it as a hardware or partition-table issue, not a boot-record issue.

Commands succeed but Windows still won't boot. This tells you the MBR was probably never the real culprit. The boot chain has layers—firmware, MBR/GPT, boot sector, BCD, then the Windows loader and kernel. Repairing the MBR fixes only the first two. Persistent failure suggests the boot files, the partition's active flag, or the Windows installation itself is the problem.

A disk that intermittently disappears from list disk, or reports read/write errors during any of these commands, is a stop condition. Further software repair risks making things worse; have the drive evaluated by a professional before continuing.

The Active Partition and Diskpart Checks

On an MBR disk, one primary partition must be flagged "active"—that's the flag telling the firmware where to find the boot code. If the active flag is missing or set on the wrong partition, you'll get boot failures even with a perfect MBR.

From the recovery prompt:

Identify your system partition (usually a small partition, often labeled "System" or "Primary"). Then:

Replace select partition 1 with the correct number from list partition. The active command marks the selected partition bootable. This is a common one-command fix for "missing operating system" errors after repartitioning or cloning drives—and it's far safer than running bootrec blindly.

Only do this if you're confident you've selected the correct partition. Marking the wrong partition active can produce a confusing boot failure. And this is purely an MBR concept—on a GPT disk, active isn't used, which is another reason to confirm your disk type first.

The UEFI and GPT Case (Where Bootrec Doesn't Apply)

If you established earlier that you're on a UEFI system with a GPT disk, the MBR repair playbook doesn't fit—there is no MBR to repair. The right approach is to rebuild the boot files on the EFI System Partition (ESP).

From the recovery command prompt, identify the ESP (typically a small FAT32 partition of 100–300 MB). Mount it to a letter, rebuild the BCD store there, and write the UEFI bootloader:

Here select volume 3 is the ESP (confirm the number from list volume), and C: is your Windows volume. The /f UEFI switch writes firmware-specific boot files. This single bcdboot command often restores a UEFI system where bootrec would have accomplished nothing. Run bcdboot /? at the prompt to see the exact syntax your Windows version supports.

If bcdboot fails, you may need to also confirm the firmware sees a valid boot entry—usually fixable in the UEFI setup's boot menu by adding a "Windows Boot Manager" entry pointing at the ESP. The precise menu labels vary by manufacturer.

Set Up a Repeatable Repair Kit Before You Need It

The worst time to learn these commands is when your only computer is dead. A little preparation turns a panic into a ten-minute fix.

Create Windows installation media now and keep it on a USB stick. It doubles as your recovery environment whenever boot fails. Confirm your system's boot mode in advance—note whether firmware uses UEFI or legacy BIOS, and whether your disk is GPT or MBR. That one fact determines which entire section of this guide applies to you. If you dual-boot or regularly clone drives, keep a note of your partition layout.

It also helps to understand which repair fits which symptom, because it saves you from the shotgun approach of running every command:

Symptom MBR/BIOS system UEFI/GPT system
"Missing operating system" Check active flag, then bootrec /fixmbr Rebuild boot files with bcdboot
"Bootmgr is missing" bootrec /rebuildbcd bcdboot
Disk not detected in firmware Hardware or partition table issue—stop and diagnose Same
Boots after boot files fixed but freezes Check BCD and Windows install files Same

The table isn't a substitute for confirming your disk type—it's a fast index once you have. And note the bottom two rows: they remind you that MBR repair is one rung on a longer ladder.

Preventing the Next Boot Failure

MBR corruption usually has a cause, and the common ones are worth knowing so you can avoid a repeat. Interrupted Windows updates that write to the boot sector mid-process are a frequent trigger—never power off during an update if you can help it. A second operating system's bootloader install, especially from older Linux installers that default to writing to the MBR, can overwrite it; if you install another OS, back up the boot records first. Malware that targets the boot sector is rarer now but still exists. And a failing drive corrupting sectors near the start of the disk produces the same symptoms as software damage, which is why hardware checks matter.

For the simplest safety net, verify your Windows system restore and recovery options are enabled, and consider imaging software that captures the whole disk including the boot sector—those images can restore a working boot in minutes. Keeping the installation media from above is the low-effort baseline.

A practical routine: after any major OS change, dual-boot install, or partition resize, reboot once deliberately to confirm the system still starts. Catching a boot problem immediately, while you still have the context of what you changed, is far easier than diagnosing it weeks later.

Bottom Line on the Command Sequence

For a standard MBR/BIOS machine with a corrupted master boot record, the sequence is: boot to WinRE or installation media, identify your Windows drive letter, run bootrec /fixmbr, bootrec /fixboot, bootrec /scanos, and bootrec /rebuildbcd (answering yes to add installations), then bootsect /nt60 SYS /mbr if /fixboot was denied. Verify the active flag with diskpart if errors persist. If you're actually on UEFI/GPT, use bcdboot instead—the MBR commands are simply the wrong tool. The fastest way to avoid a wrong turn is to confirm your disk type before you type anything.