How to boot from VHD file

If you want to boot a VHD file, you need to run the commands below.  If you don’t know how to create a VHD, it can be done in several ways. The easiest way I found it by creating a VM in VBox and then convert the VM harddisk to VHD (read this post) if you need.

Commands needed to add you VHD in the boot list of Windows 7:

 

This line will return you a guid, make sure you replace “<guid>” with the new one.

C:>bcdedit /copy {current} /d "New VHD Description" 
If your path include spaces, you can do as follow: vhd="[driveletter:]<directory><vhd filename>"
C:>bcdedit /set <guid> device vhd=[driveletter:]<directory><vhd filename> C:>bcdedit /set <guid> osdevice vhd=[driverletter:]<directory><vhd filename> C:>bcdedit /set <guid> detecthal on

.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/}.csharpcode pre { margin: 0em; }.csharpcode .rem { color: #008000; }.csharpcode .kwrd { color: #0000ff; }.csharpcode .str { color: #006080; }.csharpcode .op { color: #0000c0; }.csharpcode .preproc { color: #cc6633; }.csharpcode .asp { background-color: #ffff00; }.csharpcode .html { color: #800000; }.csharpcode .attr { color: #ff0000; }.csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em;}.csharpcode .lnum { color: #606060; }

Advertisements