Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Bootrec.exe is a powerful command-line tool in Windows used for troubleshooting and repairing the Master Boot Record (MBR), Boot Sector, Boot Configuration Data (BCD), and other critical boot-related components. Understanding how to use Bootrec can be essential for system administrators and IT professionals when dealing with boot issues, such as a corrupted MBR or missing BCD.
In this guide, we will explore the functionalities of Bootrec and provide practical examples of how to use it through PowerShell and Batch scripts. This will help you automate the repair process and integrate it into your system recovery toolkit.
Examples:
To use Bootrec, you need to access the Command Prompt with administrative privileges. This is typically done through the Windows Recovery Environment (WinRE).
Accessing WinRE:
Running Bootrec Commands:
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd
You can create a Batch script to automate the Bootrec commands. This script can be saved on a USB drive and run from the Command Prompt in WinRE.
@echo off
echo Repairing MBR and Boot Sector...
bootrec /fixmbr
bootrec /fixboot
echo Scanning for Windows installations...
bootrec /scanos
echo Rebuilding BCD...
bootrec /rebuildbcd
echo Boot repair complete.
pause
Saving the Script:
.bat
extension, for example, bootrepair.bat
.Running the Script:
X:\> bootrepair.bat
While Bootrec is a command-line tool, you can invoke it from a PowerShell script if you prefer working with PowerShell.
Write-Host "Repairing MBR and Boot Sector..."
Start-Process -FilePath "bootrec.exe" -ArgumentList "/fixmbr" -Wait
Start-Process -FilePath "bootrec.exe" -ArgumentList "/fixboot" -Wait
Write-Host "Scanning for Windows installations..."
Start-Process -FilePath "bootrec.exe" -ArgumentList "/scanos" -Wait
Write-Host "Rebuilding BCD..."
Start-Process -FilePath "bootrec.exe" -ArgumentList "/rebuildbcd" -Wait
Write-Host "Boot repair complete."
Saving the Script:
.ps1
extension, for example, bootrepair.ps1
.Running the Script:
X:\> powershell.exe -File bootrepair.ps1