@npocmaka_:
Welcome to DosTips!
@Squashman:
You’re absolutely right, as usual.
I overlooked this line:
Dave had said previously that one solution would be to use delayed expansion, so I made a link where there was none and confused !1z! in Endoro’s snippet with the erroneous !~z1!.
And that’s not all…
@Dave:
Dave Benham wrote:You never have those problems when using delayed expansion or FOR variables because the parser has finished parsing the IF statement before the delayed expansion or FOR variable expansion takes place.
Well, I was obviously on autopilot yesterday.
I should really pay more attention. If people go to the trouble to answer my questions, the least I can do is take the time to read their answers properly.
All the same, the code in my previous post is a viable workaround for the undefined %~z1 problem.
- SB