If you put my code in a batch file, you need to put two percents in front of "x" in the "for" line. I entered it at the cmd prompt directly which does not use the double percents.And your code doesn't work (and I could find no variation of it that worked) in my cmd.exe. Specifically I always get the error message "x was unexpected at this time.".