DO /L, where did my string go?

May 20, 2008
11,285
95
Syracuse, NY, USA
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".
 
May 20, 2008
11,285
95
Syracuse, NY, USA
1. There shouldn't be switches after "/L" ... right?
2. /Q is rather difficult to use because it doesn't remove the quotes.
 
May 20, 2008
11,285
95
Syracuse, NY, USA
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
 

rconn

Administrator
Staff member
May 14, 2008
12,312
147
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.
 
May 20, 2008
11,285
95
Syracuse, NY, USA
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
 

rconn

Administrator
Staff member
May 14, 2008
12,312
147
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.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Where did "BP-White" go? Support 1
vefatica Where did my font go? Support 16
Peter Murschall BDEBUGGER "Run to Cursor" - where is it ? Support 1
Alpengreis How to? Where is a ChangeLog for v25 build 16 Support 4
vefatica Where's @TASCII? Support 0
MickeyF where to view the latest JPSoft newsletter? Support 0
M WAD A case where the "List" command is clearly not working at all... Support 4
S Forum: Where is "what's new" control information? Support 1
Roedy where are the colours Support 1
M Where am I going wrong with ALIAS??? Support 7
G Where is JpSoft.com? Support 12
Gorlash tcc V11.00.37 - where is history.txt ?? Support 1
C how to copy to folder where I need admin rights Support 5
vefatica Where's the email? Support 0
M TCC Can't find WScript.exe where it says it is Support 0
C where's the .ini file gone? Support 3
samintz 27.0.21 Did not update ES Support 2
M Why did BEEP just quit working? Support 12
Phileosophos Did enumservers break? Support 5
Fross Did The Forums Go Back In Time? Support 6
R Portable install with v21 - why did it not work? Support 3
TT's Help! Uninstalling TCC did not restore cmd.exe as Win10 default batch file processor. Support 4
S Documentation Did not see 15.01.44 announcement Support 10
M @Files sure doesn't work the way I would have assumed it did! Support 4
Stefano Piccardi Why did Windows create an encryption key? Support 5
Stefano Piccardi did the forum software change in the last two days? Support 2
S Emailed post did not show up Support 0
P Inserting string into a variable. Support 3
M Backquoted parameters used in GoSub don't pass string as a single parameter Support 2
H Behavior change re piping a string to a Java program Support 1
C email[string] function Support 10
D Finding a string position in a larger string Support 2
MikeBaas How to...extract a string from a .json-file? Support 10
D Faster string search Support 8
D btm file command line augments comparing for string or math. Support 12
B How can TCC make an output as a part of command string Support 2
Alpengreis A leading withespace in Hash-String is not included? Support 1
T TPipe: Replacing String with Double Quotes Support 3
J WAD utf8decode string only results in ? chars Support 2
scooter_de How to? How to split the a string? Support 4
C custom string compare? Support 8
C Best way to validate a string is a YYYYMMDD Support 7
Phileosophos Documentation TPIPE /string type code confusion Support 4
vefatica WAD "tokens=*" and literal string Support 4
vefatica Back-refs in TPIPE's /replace's replacement string? Support 2
vefatica @B64ENCODE[s,string]? Support 8
vefatica Random access to the characters in a string? Support 4
vefatica @WORD[], quoted string? Support 8
H "Here-String" redirection not working Support 6
C Can't remove leading quote from a string Support 2

Similar threads