使用Windows系統(tǒng)的用戶有時會遇到系統(tǒng)引導(dǎo)文件丟失,造成系統(tǒng)無法正常啟動。Windows系統(tǒng)引導(dǎo)文件丟失,即系統(tǒng)目錄下Boot目錄及Bootmgr丟失,一般的解決方案有如下兩種:
1. 進(jìn)WINPE系統(tǒng)進(jìn)行修復(fù)。
2. 利用bootbcd修復(fù),bootbcd c:\Windows /s c:。
第二種方法可能會報錯:BFSVC: Failed to set element application device. Status = [c00000bb],此時可以用如下的腳本進(jìn)行修復(fù)。
如將該腳本保存為Windowstest.bat,需要修復(fù)的盤為z盤,運行命令Windowstest.bat 即可。
::@echo off
::make sure have one parameter
if [%1] == [] exit 1
::create environment
bcdboot %1:\Windows /s %1:
del %1:\Boot\BCD
::create BCD Filebcdedit.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 keyfor /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