Can alias pass parameters to for command?

Apr 28, 2013
4
0
alias a=echo %*
It work.
>a 1 2 3
1 2 3

alias b=`for %f in (%*) echo %f`
It doesn't work.
>b 1 2 3

output nothing.
 
I'm not sure exactly what's going on here, but it has something to do with the parsing of parentheses:

Code:
C:\>alias b=`echo ( %* )`

C:\>b foo bar fum
(  ) foo bar fum

C:\>alias b=`echo ( %$ )`

C:\>b foo bar fum
( foo bar fum )

C:\>

But the help file only describes %$, not %*. I'm guessing %* is a spillover from batch files. If it works with aliases, it's only by accident. Anyway, that's my guess.
 

Similar threads