We are going to use a system command called BCDedit to re-create the BCD file.
Introduction
BCDedit is a really powerful tool that Windows 7 and Windows Vista uses to manage the boot loader entries.
BCDEDIT needs a boot loader file to boot your system.
A boot loader is a file that contains necessary information that instruct the system how to boot/start an operating system.
• Windows 7 and Vista bootloader file is \bootmgr
• Windows XP bootloader file is \ntldr
Bcdedit edits a file called BCD, which is located in Windows 7's hidden partition under C:\boot\BCD.
NOTE: Before performing any changes to your system, please make sure you have a backup of system and personal data files. A backup is essential if things go wrong, when you are making changes to your system.
How to Create a Clean BCD file:
Put your Windows 7 DVD in the drive and restart your PC. Assuming you've properly configured your BIOS to boot from CDs/DVDs before hard drives, you should get a prompt asking you to "Press any key to boot from the CD/DVD..."
Go ahead and press any key.
In the next window, select "Repair your computer" to continue.
On the next window, choose the Windows 7 installation that you'd like to perform the repair on.
Click the Next button.
Proceed with the process by choosing "Command Prompt" from this list [Image below]. We could select the "Startup Repair" to fix the boot problem, but we are assuming that you already tried this option and it did not work.
In the Command Prompt window we shall perform a number of commands to create the new BCD file.
Note: We're assuming that the boot drive is drive C: below. If your computer is configured differently, be sure to use the appropriate drive letter here instead. Each command shown below is separated by a newline for display purposes only. So, command and its switches must be on the same line.
Enter the following commands:
bootrec.exe /fixmbr
X:\boot\bootsect.exe /nt60 all /force
Replace X in the command line above with the device letter to the CD/DVD drive that is running your Windows 7 Recovery Disk.
Now remove the old BCD registry, and create a new one instead.
del C:\boot\bcd
bcdedit /createstore c:\boot\bcd.tmp
bcdedit.exe /store c:\boot\bcd.tmp /create {bootmgr} /d "Windows Boot Manager"
bcdedit.exe /import c:\boot\bcd.tmp
bcdedit.exe /set {bootmgr} device partition=C:
bcdedit.exe /timeout 12
del c:\boot\bcd.tmp
Now we have a clean, working Win 7 bootloader. But we need to add a Win 7 entry to it:
bcdedit.exe /create /d "Windows 7" /application osloader
bcdedit.exe should return a message with a GUID for the newly-created entry. It will look something like this:
The entry {fc8bcc18-8a93-11df-baf9-806e6f6e6963} was successfully created.
You'll need to use the value that bcdedit.exe returned for you below, along with the drive letter for the drive that Windows 7 is installed to:
bcdedit.exe /set {fc8bcc18-8a93-11df-baf9-806e6f6e6963} device partition=C:
bcdedit.exe /set {fc8bcc18-8a93-11df-baf9-806e6f6e6963} osdevice partition=C:
bcdedit.exe /set {fc8bcc18-8a93-11df-baf9-806e6f6e6963} path \Windows\system32\winload.exe
bcdedit.exe /set {fc8bcc18-8a93-11df-baf9-806e6f6e6963} systemroot \Windows
And, last of all, tell the Windows 7 bootloader to boot the new entry by default:
bcdedit.exe /displayorder {fc8bcc18-8a93-11df-baf9-806e6f6e6963}
bcdedit.exe /default {fc8bcc18-8a93-11df-baf9-806e6f6e6963}
Now the Windows 7 bootloader has been removed and rebuilt from scratch.
At this point, you have a clean and hopefully a fully-working bootloader with one entry for Windows 7.
Reboot your PC system to get back into Windows 7.
___
This also works if you are missing the /boot folder in your windows
ReplyDeleteAmazing tip!. Trank you.. you saved me. I executed these commands with "hirens boot CD" and my windows 7 back to life!. Thank you again!
ReplyDeleteWhen you made this, did you think it looked ok? It's impossible to tell where the "spaces" are when you use italics for commands.
ReplyDeleteWorks fine, thanks for sharing
ReplyDelete