Installing Windows using the command line
This is a quick guide on installing Windows using the command line (CMD). It’s mainly for UEFI-based hardware, but it works on BIOS systems too, with a few exceptions.
First, you’ll want to launch the Windows installation media—ideally, the version you're installing. But you can use any installation media, or even an existing OS if needed.
Let's start with the partitions. Use diskpart
for these commands.
list disk
select disk 0
clean
convert gpt
create part efi size 512
format fs fat32 quick
assign letter w
create part msr size 16
create part primary
format quick label windowsbla
assign letter c
Now, moving to the installation directory and going to install.wim directory.
d:
cd sources
Then, list SKUs.
dism /get-wiminfo /wimfile:install.wim
Find out your desired SKU number, then deploy it.
dism /apply-image /imagefile:install.wim /index:2 /applydir:C:/
Finally, set up UEFI boot.
bcdboot C:\Windows /s W:
Reboot and enjoy.
wpeutil reboot
On a fresh install, after the last command, your computer is going to boot into the newly created EFI partition and will show the Windows OOBE right away.
The cool thing about installing Windows this way is that you are in control on what you're doing with the system; setting up partitions, then deploying the file into a directory, etc.
This is also useful for dual or triple-booting Windows versions. If you feel like adding a new Windows into your machine, just create a NTFS partition (skipping EFI and MSR), and then use the dism
command to deploy any ISO into the newly created partition. Add that new volume into EFI (use bcdedit /create
, etc...) and then launch it from Windows Boot Manager. Not even need to use USB or leave Windows at all.
This is an old post, published on December 29th 2019 by Cameron Martin on the BBJProjeK The Agency Slack group. Updated to be published on this website.