Here is how to install windows using command line, this could be used to install windows on any hard drive to work in another computer or to bypass any problem during normal windows installation.
- Boot your computer using the Windows installation media (e.g. a USB drive).
- Once you reach the command prompt, you can begin the installation process.
- Use the “diskpart” command to create a new partition for Windows. You can use the following commands to create a new partition:
diskpart list disk select disk X (where X is the number of your target hard drive) clean convert gpt (if you want to use UEFI) create partition efi size=100 format quick fs=fat32 label="System" assign letter=S create partition msr size=16 create partition primary format quick fs=ntfs label="Windows" assign letter=D exit
- Once the partition has been created and assigned a drive letter, use the “dism” command to list the available Windows editions and their indexes on the installation media. You can use the following command:
dism /get-imageinfo /imagefile:install.wim
This command will display a list of the available editions and their indexes.
- Choose the edition you want to install by noting down the index number. For example, if you want to install the Pro edition of Windows and the index number for the Pro edition is 2, you would use the following command to apply the Pro edition to the newly created partition:
dism /apply-image /imagefile:install.wim /index:2 /applydir:D:\
Replace “2” in the command above with the index number of the edition you want to install.
- Use the “bcdboot” command to configure the boot loader on the partition. You can use the following command:
bcdboot D:\Windows /s S: /f UEFI (where D:\ is the drive letter of the partition where Windows is installed and S: is the drive letter of the EFI partition)
- After the installation completes, you can exit the command prompt and restart your computer.