How to iterate through all arguments in batch script?

use shift command with goto, shift would copying each parameter into the previous one, %3 to %2, %4 to %3, etc. and leave %0 and %1 unaffected.


    @echo off
    set path=%~d0%~p0

    :start
    rem "%path%pngquant.exe" --force --verbose 256 %1
    echo %1
    shift
    if NOT x%1==x goto start

    pause