Can't boot into Win7

Docfxit

Distinguished Member
When I try to boot into Win7 I get a BSOD 0x7b.
I am trying to repair the BCD with this bat file:
@echo On
:: Section Removed because of too many characters in this post
:grinning:oIt
Bootrec /scanos >%~dp0BootFixerTest.txt
type %~dp0BootFixerTest.txt |find /i "Windows installations: 0" >nul || goto :grinning:one
set "ask="
set /p "ask=No installations found: type YES to rebuild BCD: "
if /i not "%ask%"=="YES" goto :FixBootRec
If not exist %ToDrive%\BCD_Backup md %ToDrive%\BCD_Backup
bcdedit /export %ToDrive%\BCD_Backup\BCD
attrib %ToDrive%\boot\bcd -h -r -s
Set "i=1"
:again
If exist "%ToDrive%\boot\bcd.old_%i%" (
set /A "i=i+1"
goto :again)
ren %ToDrive%\boot\bcd bcd.old_%i%
bcdedit /createstore C:\Boot\BCD
bcdedit.exe /store C:\Boot\BCD /create {bootmgr} /d "Windows Boot Manager"
bcdedit.exe /store C:\Boot\BCD /set {bootmgr} device partition=C:
bcdedit.exe /store C:\Boot\BCD /timeout 10
::bcdedit /create {bootmgr}
::bcdedit /set {bootmgr} device boot
::bcdedit /timeout 5
bcdedit /create /d "Windows 7" /application osloader
bcdedit /set {default} device partition=%ToDrive%:
bcdedit /set {default} path \windows\system32\boot\winload.exe
bcdedit /set {default} osdevice partition=%ToDrive%:
bcdedit /set {default} systemroot \Windows
bcdedit /set {default} detecthal yes
bcdedit /displayorder {default} /addlast
:FixBootRec
BOOTREC /fixmbr
BOOTREC /fixboot
Set "CDDrive="
For /F "Tokens=*" %%a In ('WMIC LogicalDisk WHERE^
"DriveType=5 AND Access=1 OR Access=3" Get Caption 2^>Nul') Do For %%b In (
%%a) Do If Exist %%b\I386\ Set "CDDrive=%%b"
Echo (CDDrive = %CDDrive%
If Not Defined CDDrive GoTo :grinning:idn'tCopy
If Exist %CDDrive%\I386\NTLDR Echo(Copy %CDDrive%\I386\NTLDR %ToDrive%
If Exist %CDDrive%\I386\NTDETECT.COM Echo (COPY %CDDrive%:\I386\NTDETECT.COM %ToDrive%\
:grinning:idn'tCopy
BOOTREC /rebuildbcd

:: bootsect /nt60 SYS %ToDrive%\
:: bootsect /nt60 ALL %ToDrive%\
bootsect /nt60 %ToDrive% /mbr
:grinning:one
bcdedit /enum

I am getting an error when the bat file gets to:
bcdedit /create {bootmgr}
The error says:
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

What could the problem be?
Win7 32bit
Running from Booted CD with Win7 Repair console.

This is the output of the bat file:

C:\Dnload>Bootrec /scanos 1>C:\Dnload\BootFixerTest.txt

C:\Dnload>type C:\Dnload\BootFixerTest.txt | find /i "Windows installations: 0" 1>nul || goto :grinning:one

C:\Dnload>set "ask="

C:\Dnload>set /p "ask=No installations found: type YES to rebuild BCD: "
No installations found: type YES to rebuild BCD:
C:\Dnload>if /I not "yes" == "YES" goto :FixBootRec

C:\Dnload>If not exist C:\BCD_Backup md C:\BCD_Backup

C:\Dnload>bcdedit /export C:\BCD_Backup\BCD
The operation completed successfully.

C:\Dnload>attrib C:\boot\bcd -h -r -s

C:\Dnload>Set "i=1"
C:\Dnload>bcdedit /createstore C:\Boot\BCD
The operation completed successfully.

C:\Dnload>bcdedit.exe /store C:\Boot\BCD /create {bootmgr} /d "Windows Boot Manager"
The entry {bootmgr} was successfully created.

C:\Dnload>bcdedit.exe /store C:\Boot\BCD /set {bootmgr} device partition=C:
The operation completed successfully.

C:\Dnload>bcdedit.exe /store C:\Boot\BCD /timeout 10
The operation completed successfully.

C:\Dnload>bcdedit /create {bootmgr}
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /set {bootmgr} device boot
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /timeout 5
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /create /d "Windows 7" /application osloader
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /set {default} device partition=C::
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /set {default} path \windows\system32\boot\winload.exe
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /set {default} osdevice partition=C::
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /set {default} systemroot \Windows
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /set {default} detecthal yes
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>bcdedit /displayorder {default} /addlast
The boot configuration data store could not be opened.
The volume for a file has been externally altered so that the opened file is no longer valid.
The volume for a file has been externally altered so that the opened file is no longer valid.

C:\Dnload>BOOTREC /fixmbr
ÿþT h e o p e r a t i o n c o m p l e t e d s u c c e s s f u l l y .
C:\Dnload>BOOTREC /fixboot
ÿþT h e o p e r a t i o n c o m p l e t e d s u c c e s s f u l l y .
C:\Dnload>Set "CDDrive="

C:\Dnload>For /F "Tokens=*" %a In ('WMIC LogicalDisk WHERE "DriveType=5 AND Access=1 OR Access=3" Get Caption 2>Nul') Do For %b In (%a) Do If Exist %b\I386\ Set "CDDrive=%b"

C:\Dnload>For %b In (Caption
) Do If Exist %b\I386\ Set "CDDrive=%b"

C:\Dnload>If Exist Caption\I386\ Set "CDDrive=Caption"

C:\Dnload>For %b In (D:
) Do If Exist %b\I386\ Set "CDDrive=%b"

C:\Dnload>If Exist D:\I386\ Set "CDDrive=D:"

C:\Dnload>For %b In (
) Do If Exist %b\I386\ Set "CDDrive=%b"

C:\Dnload>Echo (CDDrive =
(CDDrive =

C:\Dnload>If Not Defined CDDrive GoTo :grinning:idn'tCopy

C:\Dnload>BOOTREC /rebuildbcd
ÿþS c a n n i n g a l l d i s k s f o r W i n d o w s i n s t a l l a t i o n s .
P l e a s e w a i t , s i n c e t h i s m a y t a k e a w h i l e . . .
S u c c e s s f u l l y s c a n n e d W i n d o w s i n s t a l l a t i o n s .
T o t a l i d e n t i f i e d W i n d o w s i n s t a l l a t i o n s : 1
[ 1 ] C : \ W i n d o w s
A d d i n s t a l l a t i o n t o b o o t l i s t ? Y e s ( Y ) / N o ( N ) / A l l ( A ) : A d d i n s t a l l a t i o n t o b o o t l i s t ? Y e s ( Y ) / N o ( N ) / A l l ( A ) : T h e o p e r a t i o n c o m p l e t e d s u c c e s s f u l l y .
C:\Dnload>bootsect /nt60 C: /mbr
Target volumes will be updated with BOOTMGR compatible bootcode.

C: (\\?\Volume{49710237-f7ab-19e6-b1bc-806e6f6e6963})

Updated NTFS filesystem bootcode. The update may be unreliable since the

volume could not be locked during the update:

Access is denied.

\??\PhysicalDrive0

Successfully updated disk bootcode.

Bootcode was successfully updated on all targeted volumes.

C:\Dnload>bcdedit /enum

Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=C:
path \bootmgr
description Windows Boot Manager
locale en-US
default {default}
displayorder {default}
timeout 30

Windows Boot Loader
-------------------
identifier {default}
device partition=C:
path \Windows\system32\winload.exe
description Windows 7 Professional
locale en-US
osdevice partition=C:
systemroot \Windows

C:\Dnload>endlocal

Thanks,
Docfxit
 
Back
Top