1 Replies - 358 Views - Last Post: 25 January 2014 - 05:32 PM Rate Topic: -----

#1 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Syntax Error in For loop (batch scripting)

Posted 25 January 2014 - 05:12 PM

I don't understand why this keeps returning syntax errors. Can somebody take look and tell me how I can get it to correctly work.

for /L %%n in (1, 10, 100, 1000, 10000, 100000) do ( test.exe %%n )
Is This A Good Question/Topic? 0
  • +

Replies To: Syntax Error in For loop (batch scripting)

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3522
  • View blog
  • Posts: 12,023
  • Joined: 12-December 12

Re: Syntax Error in For loop (batch scripting)

Posted 25 January 2014 - 05:32 PM

Is there more to the error message than just "syntax error"?

The syntax is:
FOR /L %%parameter IN (start,step,end) DO command 

so you should only supply three values as the (set).

Non-numeric lists can use a standard FOR command:
FOR %%G IN (Sun Mon Tue Wed Thur Fri Sat) DO echo %%G

I do not know whether this would work for numbers, I haven't tried. If so, note that the values are space-separated.

I should qualify that I don't work with any of this, I've just done a little research.
for example and

This post has been edited by andrewsw: 25 January 2014 - 05:33 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1