Originally Posted by grail
Not having played with batch files for a while, much like syg00, I would point out that ntubski is using single % signs and has an @ in front of if.
The single % is because I was running iteractively. The @ just blocks echoing of executed commands, like in a Makefile.
To use the FOR command in a batch program, specify %%variable instead
If you think that's bad, just take a look at Delayed Expansion