Question on Not So basic macros

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Question on Not So basic macros

#16 Post by Ed Dyreen » 26 Jul 2011 16:15

'
And eol and delims end up just being = %LF% ?

When I use the example you provided, it looks like they are both = to the same thing, but the definition is what throws me off.

Delims = ^^^^^^^
Eol = ^^^^^^^%LF%%LF%^%LF%%LF%^^^%LF%%LF%^%LF%%LF%^^^^

Code: Select all

^^^^^^^"eol^^^^=^^^^^^^%LF%%LF%^%LF%%LF%^^^%LF%%LF%^%LF%%LF%^^^^ delims^^^^=^^^^^^^"

I think eol is set to a single line feed and delims is set to nothing.

I'm not sure, but it looks like it...

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Question on Not So basic macros

#17 Post by dbenham » 26 Jul 2011 16:56

Ed Dyreen wrote:

Code: Select all

^^^^^^^"eol^^^^=^^^^^^^%LF%%LF%^%LF%%LF%^^^%LF%%LF%^%LF%%LF%^^^^ delims^^^^=^^^^^^^"

I think eol is set to a single line feed and delims is set to nothing.

I'm not sure, but it looks like it...

Ed - You are correct

It would probably yield the same result if both were set to <LF>, but the syntax would be even more complex with no benefit.

Dave Benham

Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Re: Question on Not So basic macros

#18 Post by Acy Forsythe » 29 Jul 2011 11:26

Ok I was looking at it wrong then... Here's what I get:

Code: Select all

Var2=^"eol^=^

^ delims^=^"



The blank line under delims is put there before I get the next pompt and not part of the definition. I also missed that quote.

I'm going to guess that the ^ is actually escaping the quote in the definition then so it doesn't get stripped out?

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Question on Not So basic macros

#19 Post by dbenham » 29 Jul 2011 13:00

Yes, I think that is correct.

In jeb's original post showing how to disable eol by setting it to <LF>, the string actually ended with two unescaped double quotes :!:

Code: Select all

for /F ^"eol^=^

delims^=""
The reason that code works has to do with quirks in the special parsing that happens with FOR commands. I believe it doesn't work with a naked " at the end (again because of odd FOR parsing rules). My mind struggled with the concept of unbalanced quotes, with one of them somehow getting stripped out by the time the FOR command is executed. I discovered you could replace the "" at the end with ^", and at least for me the syntax makes more sense that way.

Dave Benham

Post Reply