Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

DO /L, where did my string go?

May
13,199
180
Code:
v:\> do x in /t" " /L /o:x /c:d /a:d ( echo %x )
/c:d
/a:d

Where did my first string go? The help says "stringset" is expected after "/L".
 
1. There shouldn't be switches after "/L" ... right?
2. /Q is rather difficult to use because it doesn't remove the quotes.
 
Actually, /Q seems to turn off looking for more switches. It works fine without quotes.
Code:
v:\> do x in /q /c /p /l /o:s (echo %x )
/c
/p
/l
/o:s

Couldn't /L behave similarly?

Oops! But with /Q, it does find (and get rid of) another /Q!
Code:
v:\> do x in /q /q /c /p (echo %x )
/c
/p
 
No, /L can't behave like /Q without breaking backwards compatibility.

/Q will only work without quotes if you have no whitespace in your arguments.

Your examples cannot work unless DO has a custom parser. There's no way for a general-purpose parser to know that sometimes your options are options, and sometimes your options are arguments, and only you know the difference.

And DO is not going to have a custom parser.
 
Never mind. It just doesn't make sense to me. After /L, it accepts /q, /c, and /p as strings. But it won't accept /L (though it already has one) or /o:x (which, as a switch, is meaningless with /L).
Code:
v:\>  do x in /l /q /c /p (echo %x )
/q
/c
/p

v:\> do x in /l /o:x /q /c /p (echo %x )
/q
/c
/p

v:\> do x in /l /l /o:x /q /c /p (echo %x )
/q
/c
/p
 
Nothing unexpected there -- some options (like /C, /P, and /Q) are only valid if they're at the beginning of the command.

Your /L /L is interpreted as a single option that you inexplicably repeated. It's not the parser's job to make assumptions about what you might have intended, and in fact this is a fairly common occurrence with aliases.

And the /O:x is processed and removed before the /L is processed.
 
Back
Top
[FOX] Ultimate Translator
Translate