@echo -off
 @cls
 @echo !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 @echo !!!!!!!!!!!!! This is Consumer SKU !!!!!!!!!!!!!
 @echo !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 @echo 
 @echo WARNING: This utility will reprogram the whole SPI Flash chip which
 @echo WARNING: includes system BIOS, TXE or ME firmware!!!
 @echo WARNING: DO NOT continue unless you are 100% sure you want to do this.
 @echo WARNING: To stop, turn off your computer and remove the update media,
 @echo WARNING: or do not run THIS SCRIPT.
 @pause
 @cls
 
# Step 1: Execute BIOS Update
@AfuEfix64.efi BPCRL03103.BIN /p /b /n /r /l

# Step 2: Check execution result
# If BIOS update is successful (lasterror is 0), proceed with ME and EC
if %lasterror% == 0 then
    # Step 3: Flash ME firmware
    @Fpt.efi /f BPCRL03103.BIN -me
    # Step 4: Flash EC firmware
    @ifu64.efi EC10300D.PWL 0 /C
    # Step 5: Global Reset to apply changes
    @Fpt.efi /greset
else
    # If BIOS update fails, display error and skip following steps
    @echo .
    @echo [ERROR] BIOS Update FAILED with code %lasterror%.
    @echo [ERROR] To prevent system mismatch, ME and EC updates were skipped.
    @echo .
endif

:EXIT

