Welcome!

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

SignUp Now!

DO f in /L <list of file names>?

May
12,834
163
I want to ...
Code:
alias foo `do f in /L %$ (...)`
where the arguments to the alias will be file names (quoted if necessary). DO's handling of a list (/L) seems to prevent this.
Code:
v:\> do f in /L "1 2" 3 4 ( echo %f )
"1
2"
3
4

FOR %f IN ( %$ ) handles it OK. And I suppose I could use a delimiter (say ';') but then I'd have to talk myself out of the 20+ year habit of separating file names with spaces. Is there a reason why quoted strings among DO /L's set are not handled as they are everywhere else in TCC?
 
DO /L cannot handle filenames; as the docs say it is for strings (which have no concept of quoted args or LFNs), not "lists" or a "set" (whatever you mean by that).

If you want to pass filenames, you don't need (or want) a /L.
But without /L, you can't give it a space-separated list of file names ( like an alias's %$ ) ... or can you?
 
Sure you can.

But a file must (1) exist and (2) be in the current (or specified) directory to be processed. I want to specify any collection of filenames and have those that don't exist be created. Can I get the same result as this alias with DO?
Code:
v:\> alias e
for %f in ( %$ ) if not exist %f touch /q /c %f & textpad %$
Below, both files exist by the time the editor is started.
Code:
v:\> e "v:\1 2.txt" "v:\test\3 4.txt"
 
DO /L's handling of quoted spaces does seem surprising and awkward. Doubtless you can't change it without breaking eleven hundred batch files. How about a new option, say /W, that does the same job, but recognizes quoted args the way almost everything else does?
 

Similar threads

Back
Top