On Thu, 24 Mar 2011 13:31:42 -0400, rconn <> wrote:
|---Quote (Originally by vefatica)---
|I'm complaining about the command line DO (which hasn't been around that long). What could be simpler than I want "foo^r^n" to be echoed three times? It doesn't do it.
|---End Quote---
|
|Still WAD, regardless of what you're complaining about or how long it's been around.
|
|Think for a minute what you're doing -- you've passed a command line to DO that looks like:
|
|do i=1 to 3 ( echo fooCRLF )
|
|Do duly sends "echo fooCRLF" back to the parser for another pass, at which time the trailing CR/LF is stripped and "foo" is passed to ECHO. If you want to protect the escape characters on the first pass, double them or use back quoting.
|
|This will never, ever, change -- it would break every existing batch file that uses DO. (And I'm absolutely not going to create a polymorphic version of DO that behaves differently depending on whether it's a single-line or multiline DO.)
The long version of DO (in batch files) doesn't do that. That's what makes it
so surprising. I doubt any users (new or long-time) would expect to need a
gadget here, like "DO I=1 TO 3 ( ECHO foo^^r^^n )".
Code:
v:\> type dotest.btm
do i=1 to 3
echo foo^r^n
enddo
v:\> dotest.btm
foo
foo
foo
I won't get used to it but when it bites me I should recall what's needed. :-)