Skip to content

Instantly share code, notes, and snippets.

@nehaljwani
Created April 13, 2016 10:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nehaljwani/8a71cc1933c29e611e9e850efe7c681d to your computer and use it in GitHub Desktop.
Save nehaljwani/8a71cc1933c29e611e9e850efe7c681d to your computer and use it in GitHub Desktop.
Solution to "Drive where windows is installed is locked" (Legacy Mode)
Here is what I do in the video.
First, I attempt to try and boot normally. The computer says, no bootable device found. Try a second time, still fails.
Then I boot using a bootable Windows Recovery/Installation media, to try a refresh/reset.
Main Screen->Next->Repair Your Computer->Troubleshoot->Refresh your PC->Next->Drive where blah blah... :'(
Main Screen->Next->Repair Your Computer->Troubleshoot->Reset your PC->Next->A required partition blah blah... :'(
Let's try some shell magic.
Main Screen->Next->Repair Your Computer->Troubleshoot->Advanced Options->Command Prompt
Let's try what most people/forums suggest.
bootrec /fixmbr
bootrec /fixboot
bootrec /rebuildbcd
In my case, first command->success, other two: 'Element Not Found'
If all the commands are successfull for you, then just close everything and reboot normally.
bootsect /nt60 all /force ->Will be successfull in most cases, but it won't necessarily fix the problem.
Nevertheless, try and reboot and see if the problem got fixed.
In my case, still the same error.
Open Command Prompt Again.
First, find out the drive letter of the partition in which Windows is installed.
I type:
diskpart
list vol
To find out all volumes with some letter auto-assigned to them.
Then I try to do dir X: (Replace X with the drive letters you see in the output for the above command)
And find out which drive letter has all the files related to a Windows installation. In my case, it turned out to be C:
At this point, you should try out the following (not in the video):
Mark the volume with the windows installation in it as active
diskpart
list vol
sel vol X (Replace X with the volume number which has Windows in it)
active
exit
bcdboot X:\Windows /l en-us /s X:
If the above command is successfull, go ahead and reboot.
If everything above fails, then go back to the command prompt and do the following:
(Remember, replace C: with the drive letter of the partition in which Windows is present)
del C:\boot\bcd
md C:\boot
Create temporary BCD file
bcdedit /createstore C:\boot\bcd.temp
Add an entry into this
bcdedit /store C:\boot\bcd.temp /create {bootmgr} /d "Windows Boot Manager"
Let's import this entry into the 'real' BCD file
bcdedit /import C:\boot\bcd.temp <- This operation may fail. If it does, then mark the partition in which windows is installed as active.
diskpart
sel disk 0
list par
sel par X (replace X with the partition number of the partition in which Windows is installed)
active
exit
bcdedit /import C:\boot\bcd.temp #Try again.
bcdedit /set {bootmgr} device partition=C:
bcdedit /set timeout 10
Delete the temp bcd file
del C:\bcd\bcd.temp
bcdedit /create /d "Windows whatever-version" /application osloader <- Copy the UUID from this command's output
bcdedit /set {copie-uuid-from-above-command} device partition=C:
bcdedit /set {copie-uuid-from-above-command} osdevice partition=C:
bcdedit /set {copie-uuid-from-above-command} path \Windows\System32\winload.exe
bcdedit /set {copie-uuid-from-above-command} systemroot \Windows
bcdedit /displayorder {copie-uuid-from-above-command}
Fingers crossed. Reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment