In a for ... in ... do (...) loop with command grouping, when multiple commands are wrapped in the parentheses grouping, what are the limits to what or how much can be placed in the parentheses?

Is is strictly a character count or what? I have had a batch file that seemed to work fine when I had, say, 20 lines in the parenthetical grouping, but now that I have added additional lines, the command fails. The help message just says improper syntax. So I'm wondering whether I'm trying to put too much stuff in the (parentheses).

Super Moderator

In a for ... in ... do (...) loop with command grouping, when multiple commands are wrapped in the parentheses grouping, what are the limits to what or how much can be placed in the parentheses?

Is is strictly a character count or what? I have had a batch file that seemed to work fine when I had, say, 20 lines in the parenthetical grouping, but now that I have added additional lines, the command fails. The help message just says improper syntax. So I'm wondering whether I'm trying to put too much stuff in the (parentheses).

A command group is essentially one long command line, even if you split it across several physical lines. Twenty lines in one logical line seems a little excessive; I'd recommend rewriting it as a DO loop.

Scott Mintz

Aside from the actual limits that Steve pointed out, you would be better
off re-writing your FOR loops using DO loops in TCC. This make debugging
substantially easier because it allows you to single step through the
statements within the loop. Plus it eliminates the limit on compound
statement length and instead each line has its own limit.

-Scott

epement <> wrote on 04/26/2010 10:13:17 AM:

> In a for ... in ... do (...) loop with command grouping, when
> multiple commands are wrapped in the parentheses grouping, what are
> the limits to what or how much can be placed in the parentheses?
>
> Is is strictly a character count or what? I have had a batch file
> that seemed to work find when I had, say, 20 lines in the
> parenthetical grouping, but now that I have added additional lines,
> the command fails. The help message just says improper syntax. So
> I'm wondering whether I'm trying to put too much stuff in the

Aside from the actual limits that Steve pointed out, you would be better
off re-writing your FOR loops using DO loops in TCC. This make debugging
substantially easier because it allows you to single step through the
statements within the loop. Plus it eliminates the limit on compound
statement length and instead each line has its own limit.