Open the script in Notepad and locate these lines:
upon completion. This is used to return the phone to its "factory" security state. How to Use the Flash All Script Prepare the Device
@echo off set DEVICE=waiting-for-device echo Checking fastboot devices... fastboot devices > device_list.txt if %errorlevel% neq 0 ( echo Fastboot not found or device missing. exit /b 1 )
Download your Fastboot ROM and extract it using a tool like 7-Zip. Open the folder until you see the images folder and the flash_all.bat file. flash all bat xiaomi link
These files are device-specific and circulate on forums like XDA and Telegram. Search for your device codename along with terms like "unlocked firehose" or "patched loader."
The official GUI tool that executes the .bat scripts.
@echo off echo Flashing Xiaomi Fastboot ROM... fastboot flash xbl xbl.elf fastboot flash xbl_config xbl_config.elf fastboot flash abl abl.elf fastboot flash boot boot.img fastboot flash system system.img fastboot flash vendor vendor.img fastboot flash userdata userdata.img fastboot flash cache cache.img fastboot reboot echo Done! Open the script in Notepad and locate these
To flash a Xiaomi device, the file is the standard script used to perform a "clean install" by wiping all data and reflashing every partition. This is typically done through the Mi Flash Tool or manually via the Command Prompt (CMD) . 🛠️ Essential Requirements Before starting, ensure you have these items ready:
Connect your device using an original Xiaomi USB cable. Avoid USB 3.0 ports if you encounter connectivity issues; older USB 2.0 ports are often more stable in fastboot mode. 🛠️ Step-by-Step Guide to Using flash_all.bat Step 1: Extract the Fastboot ROM Download the correct .tgz Fastboot ROM for your device.
Add :: at the beginning of each line to comment them out. Save the file and rerun MiFlash. fastboot devices > device_list
Download the latest version from the Official Xiaomi Mi Flash Tool Website. 2. Download the Correct Fastboot ROM Link
By default, Mi Flash Tool often highlights "clean all and lock" ( flash_all_lock.bat ).
Save as my_flash_all.bat and place it in the ROM's images/ folder. Run as administrator.