Welcome!

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

SignUp Now!

Discarding unreferenced alias parameters

nchernoff

Administrator
May
42
2
Staff member
Migrated From JP Software Wiki

When 4NT expands aliases, it appends all unreferenced arguments to the end of the command line:

Code:
C:\>alias test=`echo one=%1 %+ echo two=%2 %+ echo three=%3`

C:\>test Alpha Beta Gamma Delta Epsilon
one=Alpha
two=Beta
three=Gamma Delta Epsilon

C:\>
Sometimes this behavior is undesirable, and you would rather just discard all of the unreferenced arguments. One simple way to do this is to end your alias with %+ rem . The REM command will receive all of the excess arguments, and duly ignore them.

Code:
C:\>alias test=`echo one=%1 %+ echo two=%2 %+ echo three=%3 %+ rem`

C:\>test Alpha Beta Gamma Delta Epsilon
one=Alpha
two=Beta
three=Gamma

C:\>
 
Back
Top