OperatorGK wrote:You don't understand: it's because argument count isn't changing with call, but it could be so if unescaped delimiters were allowed. One less caveat with call is always better. And it's eating the caret cause argument split phase is done after normal parsing phase, otherwise set "a=b c" and %a% will be parsed as 1 argument, not as 2.
Also echo follows standard rules, it just takes %* instead of %1 %2 %3....
You are right that i'm not understanding you.
I never even mentioned call, only you did.
And here i'm just trying to understand what you said earlier.
You describe the way the functionality works, with the words "unquoted delimiter characters ( ,;) aren't allowed in arguments"
SPACE is a delimiter
DEL a b<ENTER> <--- deletes a, and deletes b
^^^ That space has no quotes.
It's what I guess you might mean by "an unquoted delimiter".
It delimits. If it was quoted, it wouldn't delimit.
Maybe you mean quoted delimiter characters aren't allowed in arguments?
well, if the space is quoted it wouldn't be a delimiter, would it
DEL a" "b<ENTER> <--- that works too
And a quoted space is allowed and works as expected.
(My issue had nothing to do with quoted space anyway!! It was to do with a space escaped with a caret)
Maybe when you said that... "unquoted delimiter characters ( ,;) aren't allowed in arguments" you meant it doesn't allow unquoted "delimiter characters" such as ; or space, that are in the arguments to be treated as literals.. So ^SPACE isn't accepted. That is what i've said though I didn't call them delimiters when i'm talking about them being treated as literals.. And yeah the only way is for those characters to be literals in arguments is for them to be quoted ";" or " " since caret doesn't escape them.. though then they're not there alone they're there with quotes around them.. But that is just basically what I said, I didn't contradict that. I said space can be quoted in the arguments portion, just not escaped with a caret.
You write "it's eating the caret [be]cause" <-- You seem to be telling me the reason for it eating the caret as if perhaps you thought I didn't expect it to eat the caret, but I always expected it to eat the caret, and it is. My issue is it eats it but doesn't preserve the space. So eating the caret didn't seem to do anything. Whereas it does for the file path part / the filename that precedes the arguments. And you can escape a space in the arguments, just not with caret, and that seems strange.
You make an interesting point about ECHO taking %* while DEL and others use %1 %2 %3 (so you imply that those internal commands have the same choice that batch files have.. that they see arguments the same way, that's interesting)
You use an example of SET "a=b c" (I can see set, like echo, must take %* hence set a=b works, not just set a"="b) unlike dir or del which takes %1 %2 etc I get that, that's interesting.
You mention a normal phase and a splitting phase, i'm not sure what aspects of them you refer to, and I have no doubt that if there are those two phases then the normal phase(involving eating carets), and deciding which spaces are preserved, is done before argument splitting. But you then say that if it didn't work like that then set "a=b c" and %a% will be parsed as 1 argument, not as 2. (As if you say, lucky it is passed as 2 arguments!) So you seem to imply that set "a=b c" is 2 arguments passed to set, but it's not, it is 1! Even set a=b" "c is one argument passed to set.
I can see that you can't caret escape delimiters in arguments %1 %2 %3
so, not just space but ; too..
but you can quote space or ; or whatever.
so whatever the rule is.. e.g. one rule for file path, another for %1 %2 %3 parameters at least it's easy to test, because if a command like DEL or DIR sees its parameters as %1 %2 %3 then I can echo %1 %2 and work out what it is seeing.
But it really seems the file path rule for carets is different from the argument one(as in, for batch files or internal commands).. it'd be interesting to see that rule written anywhere.
Code: Select all
C:\blah>type a.bat
echo %1
C:\blah>a t;g;h
C:\blah>echo t
t
C:\blah>a t^;g^;h
C:\blah>echo t
t
C:\blah>a t";"g";"h
C:\blah>echo t";"g";"h
t";"g";"h