echo -off
set fw_path "fw/130613.bin"
set platform "x86"
set flashall_tag " "
set address 0

for %a run (1 9)
    if %1p == armp then
        set platform "arm"
    endif
    if %1p == flashallp then
        set flashall_tag " -a"
    endif
    if %1p == preservep then
        set flashall_tag " -preserve"
    endif
    if %1p == csp then
        shift
        set address "%1"
    endif
    if %1p == p then
        goto EXECUTE
    endif
    shift
endfor

:EXECUTE
if %platform% == arm then
    Tools\gigaflash_arm.efi %fw_path% -cs %address% %flashall_tag% -2600
else
    Tools\gigaflash.efi %fw_path% -cs %address% %flashall_tag% -2600
endif

echo -on