Install/Boot Windows from VHD
Did you know you can install a windows copy to VHD/VHDX (Virtual hard drive) and book from it ?
Reuqirements
- Windows 7 or later
- Windows 7 or later ISO file
- At least 30GB free space on your hard drive
- ~1300 – 1400 gram human brain
Note: You can’t dual-boot UEFI and BIOS systems. You can only dual-boot two UEFI systems or two BIOS systems.
Getting Started
First we need VHD/VHDX file. You can create one using powershell or disk management.
Create a VHD/VHDX file
Open cmd, enter diskpart
and type the following command to create a VHD file:
Create vdisk file="c:\my_new_vhd.vhd" type=fixed maximum=30000
Note: You can change the file path and size as you wish.
Initialize the VHD file you just created:
- Open disk disk management (Winkey+X and Select disk management)
- Action –> Add SSD (or HDD)
- Select VDH file (you created while VM setup) clik ok
- Assign a drive letter to the VHD file.
Install Windows
First you need to copy install.ed/wim file. You can find in the sources folder of your windows iso file.
Get index numbers from ISO file using the following command:
dism /Get-WimInfo /WimFile:"install.wim/esd"
Apply the image to the VHD file:
dism /Apply-Image /ImageFile:"install.wim/esd" /Index:1 /ApplyDir:X:\
Note: Change the index number to the index number you got from the previous command. And X is the drive letter you assigned to the VHD file.
Create Boot files:
bcdboot X:\Windows
All done. You can boot newly installed os now!
Set Default OS
- Open msconfig (winkey+R type msconfig and enter)
- Enter Boot tab
- Selecet your main OS and click “Set Default”
This post is licensed under CC BY 4.0 by the author.