@echo off setlocal EnableDelayedExpansion nrfjprog --memrd 0x10001080 > _temp.txt set /p lot_string=<_temp.txt nrfjprog --memrd 0x10001084 > _temp.txt set /p id_string=<_temp.txt del _temp.txt for /L %%i in (0,1,7) do ( set "hex_digit=!lot_string:~12,1!" set "lot_num=!lot_num!!hex_digit!" set "lot_string=!lot_string:~1!" ) for /L %%i in (0,1,7) do ( set "hex_digit=!id_string:~12,1!" set "id_num=!id_num!!hex_digit!" set "id_string=!id_string:~1!" ) echo lot_num: %lot_num% id_num: %id_num% nrfjprog --eraseall -f NRF52 @REM ÉÕ¼lot nrfjprog -f nrf52 --memwr 0x10001080 --val 0x%lot_num% @REM ÉÕ¼ID nrfjprog -f nrf52 --memwr 0x10001084 --val 0x%id_num% nrfjprog --program output/app_whole.hex --verify -f NRF52 %ÉÕ¼% if %errorlevel% neq 0 ( echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE echo E ÉÕ¼ʧ°Ü E echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE endlocal exit /b 1 ) nrfjprog --reset -f NRF52 %¸´Î»% if %errorlevel% neq 0 ( echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE echo E ¸´Î»Ê§°Ü E echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE endlocal exit /b 1 ) echo --------------------------------------------------------------- echo - done echo --------------------------------------------------------------- endlocal