@echo off
wpeinit && echo INFO: wpeinit OK
wpeutil UpdateBootInfo > NUL && echo INFO: wpeutil UpdateBootInfo OK

for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFIRMWAREType') do set FIRMWARE=%%B

if %FIRMWARE%==0x1 (
  echo FIRMWARE=%FIRMWARE% [BIOS]
  echo ==========================
  diskpart /s %SystemDrive%\format-BIOS.txt
) else (
  echo FIRMWARE=%FIRMWARE% [UEFI]
  echo ==========================
  diskpart /s %SystemDrive%\format-UEFI.txt
)

