Using %* in TCC

#1
How does the usage of %* (percent asterisk) differ in TCC than in CMD?​

It appears that I can use this syntax anywhere under CMD. Example:​
Code:
echo @echo the args are {%%*}. >test_args.cmd
# Note that this converts to a single percent symbol on disk.
When I run this under TCC, I just get a single asterisk (star) sent to the screen, but when I run it under CMD, I get all the arguments returned between the curly braces. Changing the file type to .btm doesn't help.

In the Take Command Help v.11, "Batch File Parameters", it appears to say that the "percent asterisk" (%*) syntax is supported for Take Command, but I don't see this on my installation.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,586
46
Albuquerque, NM
prospero.unm.edu
#2
How does the usage of %* (percent asterisk) differ in TCC than in CMD?​

It appears that I can use this syntax anywhere under CMD. Example:​
Code:
echo @echo the args are {%%*}. >test_args.cmd
# Note that this converts to a single percent symbol on disk.
When I run this under TCC, I just get a single asterisk (star) sent to the screen, but when I run it under CMD, I get all the arguments returned between the curly braces. Changing the file type to .btm doesn't help.

In the Take Command Help v.11, "Batch File Parameters", it appears to say that the "percent asterisk" (%*) syntax is supported for Take Command, but I don't see this on my installation.
It's tripping over the character immediately following the %*. I'm not sure why -- but you can help the parser out by inserting spaces between the braces and the %*:

Code:
@echo the args are { %* }.
.

Other approaches, not CMD-compatible but apparently less confusing: use %$ instead of %*, or put the asterisk in square brackets:

Code:
@echo the args are {%
[*]}.
 
#3
It's tripping over the character immediately following the %*. I'm not sure why -- but you can help the parser out by inserting spaces between the braces and the %*:

Code:
@echo the args are { %* }.
Thanks, charles. Really, I wanted something that was cross-compatible with CMD.EXE, which is why the filetype was initially .cmd instead of .btm.

I will say that I initially tried [%*] as well as {%*} before posting my query, and obtained the same results.

You are correct that inserting a space before and after the parameter %* will return the expected parameters passed to the batch file.