引导文件丢失,即系统目录下Boot目录及Bootmgr丢失,一般的解决方案有如下两种:
1. 进WINPE系统进行修复。
2. 利用bootbcd修复,bootbcd c:\Windows /s c:。
第二种方法可能会报错:BFSVC: Failed to set element application device. Status = [c00000bb],此时可以用如下的脚本进行修复。
如将该脚本保存为test.bat,需要修复的盘为z盘,运行命令test.bat z即可。
::@echo off
::make sure have one parameter
if [%1] == [] exit 1
::create environment
bcdboot %1:\Windows /s %1:
del %1:\Boot\BCD
::create BCD File
bcdedit.exe /createstore %1:\Boot\BCD
::create bootmgr
bcdedit.exe /store %1:\Boot\BCD /create {bootmgr} /d "Winodws Boot Manager"
bcdedit.exe /store %1:\Boot\BCD /set {bootmgr} device partition=C:
::get device key
for /f "delims=" %%i in ('bcdedit.exe /store %1:\Boot\BCD /create /d "Windows7" /application osloader') do (
set DeviceKey=%%i
)
set DeviceKey=%DeviceKey:~2,38%
echo %DeviceKey%
::set BCD
bcdedit.exe /store %1:\Boot\BCD /set %DeviceKey% device partition=C:
bcdedit.exe /store %1:\Boot\BCD /set %DeviceKey% osdevice partition=C:
bcdedit.exe /store %1:\Boot\BCD /set %DeviceKey% path \Windows\system32\winload.exe
bcdedit.exe /store %1:\Boot\BCD /set %DeviceKey% systemroot \Windows
bcdedit.exe /store %1:\Boot\BCD /displayorder %DeviceKey%
bcdedit.exe /store %1:\Boot\BCD /default %DeviceKey%
::avoid winload.exe error
bcdedit.exe /store %1:\Boot\BCD /set {default} osdevice boot
bcdedit.exe /store %1:\Boot\BCD /set {default} device boot
bcdedit.exe /store %1:\Boot\BCD /set {default} detecthal 1