来古计算机 > Windows系统 > 正文

利用脚本修复丢失的WINDOWS引导文件

使用Windows系统的用户有时会遇到系统引导文件丢失,造成系统无法正常启动。Windows系统引导文件丢失,即系统目录下Boot目录及Bootmgr丢失,一般的解决方案有如下两种:

1. 进WINPE系统进行修复。

2. 利用bootbcd修复,bootbcd c:\Windows /s c:。

第二种方法可能会报错:BFSVC: Failed to set element application device. Status = [c00000bb],此时可以用如下的脚本进行修复。

如将该脚本保存为Windowstest.bat,需要修复的盘为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


推荐文章

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

标签列表
网站分类
最新留言

Powered By Z-BlogPHP and Terry

Copyright @ laigucomputer.com 来古计算机 工信部备案号:粤ICP备18009132号