Welcome!

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

SignUp Now!

%* vs. %$

Feb
65
1
According to the doc, these two seem to be quite close relatives ;)

But I found an undocumented difference (at least not documented where I read...):
* preserves the tail unmodified, whereas $ splits parameters.

So, when calling a bat with argument "foo=goo", echo %* shows exactly that, whereas echo %$ has "foo goo".

I could probably get around this using CMDBatchDelimeters, but since it's doc strongly advises not to use it, I hesitate.

(This is related to the issue of %* being not affected by shift /n)
 
Well, my challenge was to get the commandline after SHIFTing . I could not use %$, since that modified stuff like "foo=goo". But I gave it some thought and found that I could use %@REPL[%1,"",%*] - so thanks for your offer, but problem solved :-)
 
This batch has ONE required argument only. Based on that argument it decides wich .exe it will ultimately execute. The remaining arguments should be passed to that .exe in their original format (which may well include stuff like "foo=goo" etc.) - so SHIFTing would have been an easy way remove %1 from %*.
 
Back
Top