If I type:

Quote:
FOR /?

at the command prompt, it says (among other things):

Quote:
FOR /L %variable IN (start,step,end) DO command [command-parameters]

The set is a sequence of numbers from start to end, by step amount.
So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would
generate the sequence (5 4 3 2 1)

Which is exactly what I want to do. But if I create a batch file that looks like this:

Quote:
@echo off
FOR /L %variable IN (1,1,5) DO echo hi
pause

I get "variable was unexpected at this time", instead of printing the word "hi" five times, which is what I expect it to do.

I have tried changing the number of percent signs before the word "variable", changing "variable" to "i" or some other value, and a bunch of other tweaks, but I can't figure out why this thing isn't working as the DOS help says it should.

What am I doing wrong?

Google isn't helping, strangely.

PS: Same results on Vista and XP.
_________________________
Tony Fabris