Download Windows ISO:
Use Windows 7 USB/DVD Download tool to burn the .iso file to DVD or USB. You can use also another tool for creating bootable Windows 8 installation DVD/USB.
Create a fixed or dynamic VHD file of size 16 GB for 32-bit (or 20 GB for 64-bit) version for Windows 8/10/11. (steps 3+4 detailed below)
Attach created VHD, create a single partition and format as NTFS.
Reboot from created Windows 8 DVD or USB.
Select your language and keyboard layout and proceed to Repair your computer > Troubleshoot > Advanced Options > Command prompt.
Run diskpart. Execute command "list volume" (without quotes) to see mapping of partitions and note drive letter where VHD file is stored.
Now execute following commands to select and attach VHD:
select vdisk file="drive_and_full_path_to_vhd_file" (e.g. "c:\vdisks\win8.vhd" )
After exiting diskpart run setup.exe to start installation.
Select language and keyboard layout when prompted.
Select custom installation. Select VHD drive as destination and after confirming you will see "Installing Windows"...
After first iteration of installation is finished. Remove DVD or USB to reboot and continue installation.
Wait for operations "Getting devices ready" and "Getting system ready" and restart to Windows 8.
VHD preparation steps can be executed also after booting from installation DVD/USB just before running setup.
Example file created is win8.vhd in folder \vdisks on drive c: with size 20 GB.
Run diskpart.exe and execute these commands:
create vdisk file="c:\vdisks\win8.vhd" maximum=20000 type=fixed
select vdisk file="c:\vdisks\win8.vhd"
create partition primary
format fs=ntfs label="Win8" quick
It takes some time and effort to code apps and maintain a website, and liters of coffee ;)