Skip to content

Instantly share code, notes, and snippets.

@Alee14
Last active November 4, 2024 17:38
Show Gist options
  • Save Alee14/e8ce6306a038902df6e7a6d667544ac9 to your computer and use it in GitHub Desktop.
Save Alee14/e8ce6306a038902df6e7a6d667544ac9 to your computer and use it in GitHub Desktop.
Installing Windows using CMD. (UEFI and BIOS Supported)

Installing Windows using CMD. (UEFI and BIOS Supported)

Guide created by Andrew Lee

Note that this guide does not go into detail, it's just providing the commands to install Windows.

Be cautions when doing this when dualbooting, please backup any existing data or you will lose them all.

Open CMD

First open CMD by pressing the following keys after booting into setup: Shift + F10

Creating Partition

MBR

diskpart
list disk
select disk (number for main disk)
clean # Clearing the partitions
convert mbr
-----------------------
(Creating recovery is optional)
create part primary size 500
format quick label Recovery
assign letter R
set id 27
-----------------------
create part primary
format quick label Windows (or label of your choice)
assign letter C (or E)
active
exit

UEFI

diskpart
list disk
select disk (number for main disk)
clean # Clearing the partitions
convert gpt
create part efi size 512
format fs fat32 quick
assign letter w
create part msr size 16
-----------------------
(Creating recovery is optional)
create part primary size 500
format quick label Recovery
assign letter R
set id de94bba4-06d1-4d40-a16a-bfd50179d6ac
gpt attributes 0x8000000000000001
-----------------------
create part primary 
format quick label Windows (or label of your choice)
assign letter C (or E)
exit

Go to install.wim directory

[letter of installation disk]:
cd sources

List SKUs

Listing SKUs like Home, Pro, Education, Ultimate, etc.

dism /get-wiminfo /wimfile:[Location to install.wim]

Deploying WIM file

Copies the content from the install.wim file to the main disk.

dism /apply-image /imagefile:[Location to install.wim] /index:[SKU Number] /applydir:(Drive letter to main disk)

e.g dism /apply-image /imagefile:d:\sources\install.wim /index:6 (Win10 Pro) /applydir:C:\

Creating recovery folders and copying Windows RE to the recovery partition (Optional)

md R:\Recovery
xcopy /h C:\Windows\System32\Recovery\Winre.wim R:\Recovery
C:\Windows\System32\Reagentc /Setreimage /Path R:\Recovery /Target C:\Windows

Creating boot files

MBR only

bootsect /nt60 C: (or E:) /force /mbr

MBR + UEFI

bcdboot (Drive letter to main disk):\Windows

Add argument if it's UEFI (if needed)

/s [drive letter to UEFI]:

Bypassing the OOBE entirely (Optional)

reg load HKLM\SOFT C:\Windows\System32\config\SOFTWARE
reg load HKLM\SYS C:\Windows\System32\config\SYSTEM
reg add HKLM\SOFT\Microsoft\Windows\CurrentVersion\Policies\System /v VerboseStatus /t REG_DWORD /d 1 /f
reg add HKLM\SOFT\Microsoft\Windows\CurrentVersion\Policies\System /v EnableCursorSuppression /t REG_DWORD /d 0 /f
reg add HKLM\SYS\Setup /v CmdLine /t REG_SZ /d cmd.exe /f

Reboot

wpeutil reboot

Bypassing the OOBE entirely (P2)

Run Windows Deployment Loader then enable recovery

oobe\windeploy
Reagentc /enable (if you made a recovery parition)
Reagentc /Info /Target C:\Windows

Add user (When the boot status says "Getting Ready")

net user /add (username) (password)
net localgroup users /add (username) # in case Windows didn't add the users group
net localgroup administrators /add (username)

Clear OOBE status

reg add HKLM\SYSTEM\Setup /v OOBEInProgress /t REG_DWORD /d 0 /f
reg add HKLM\SYSTEM\Setup /v SetupType /t REG_DWORD /d 0 /f
reg add HKLM\SYSTEM\Setup /v SystemSetupInProgress /t REG_DWORD /d 0 /f
exit

Disabling VerboseStatus and Enabling CursorSuppression (Optional)

When entering the desktop open CMD as admin and run the following.

reg add HKLM\SOFT\Microsoft\Windows\CurrentVersion\Policies\System /v VerboseStatus /t REG_DWORD /d 0 /f
reg add HKLM\SOFT\Microsoft\Windows\CurrentVersion\Policies\System /v EnableCursorSuppression /t REG_DWORD /d 1 /f

Credits

If there's anything that needs to be added, feel free to tell me in the comments below!

  • Caesar (TheDarkBomber#0229): For helping fixing some things in the script that I forgot or needed to add.
@kenzieshane
Copy link

kenzieshane commented Apr 25, 2024

okay I found out the answer to my problem

Ventoy can't really open the newest Windows 10.iso v1 English;even it throws a BCD file not found error when booted without .wim mode

@pseudo137
Copy link

This looks like a fun project. If nothing at all, I'll learn what goes on behind the scenes when I install Windows the normal way. Plus, it'll come in handy if you need to fix issues like OS not booting

@Dianav171
Copy link

I hate to sound dumb, sometimes this language can overload memory on user retaining information 😩. I was able to partially use the command line to copy wim. I am not sure where I am stuck. I have an OLD Inspiron 560. I had upgraded to win 10 from windows 7 home premium. I have install disk. I somehow corrupted boot and now bootmgr is missing. Install disk does not work and my install found is O on the bootrec and bcdedit commands I have the install disk F. I have no recovery partitions any longer. I used FDISk and wiped all clean. I may have edited permissions on something prior also as I had excessive svchost files running that were access denied. I thought it was a good idea until it
Wasn’t. Is there anyway you could email me with the detail command lines to copy the files from install disk. I’ve been on the 2 weeks now and my head hurts from
This!! Please 🙏

@kenzieshane
Copy link

I hate to sound dumb, sometimes this language can overload memory on user retaining information 😩. I was able to partially use the command line to copy wim. I am not sure where I am stuck. I have an OLD Inspiron 560. I had upgraded to win 10 from windows 7 home premium. I have install disk. I somehow corrupted boot and now bootmgr is missing. Install disk does not work and my install found is O on the bootrec and bcdedit commands I have the install disk F. I have no recovery partitions any longer. I used FDISk and wiped all clean. I may have edited permissions on something prior also as I had excessive svchost files running that were access denied. I thought it was a good idea until it Wasn’t. Is there anyway you could email me with the detail command lines to copy the files from install disk. I’ve been on the 2 weeks now and my head hurts from This!! Please 🙏

try to use Linux IG, either daily drive that or use that as a medium to fix bootmgr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment