LEAVE inside an argument-acquisition loop seems to make a subsequent test for empty argument fail, as well as cause a spurious error message:
If I replace the LEAVE with a GOTO PASTEND, both these cases seem to work as intended. Am I using the LEAVE incorrectly?
[C:\batch]type foo.btm @ echo off do until (%1) == () iff (%1) == (trap) then shift leave endiff shift enddo :PASTEND iff (%1) ne () then echo (%1): too many parms! endiff [C:\batch]foo a b c trap x (x): too many parms! [C:\batch]foo a b c trap (): too many parms! TCC: C:\batch\foo.btm  Unknown command "endiff"