Parameter %$ Different in Aliases and BTMa

Jun 2, 2008
388
2
Newton, MA
Is this WAD? With aliases, the parameter %$ is passed exactly as is. In a batch file, however, some processing is done. In particular, commas become spaces.

Code:
TCC(27.01.24): C:\temp>alias argalias
echo Arguments = %$

TCC(27.01.24): C:\temp>argalias $1,200
Arguments = $1,200

TCC(27.01.24): C:\temp>type argbtm.btm
echo Arguments = %$

TCC(27.01.24): C:\temp>argbtm $1,200
Arguments = $1 200
 
Jun 2, 2008
388
2
Newton, MA
Two more questions.
  1. Why is a comma not an argument separator in an alias?
  2. Is there any way with batch files to gain access to the entire command tail as entered? This is what I thought %$ meant.
As a workaround, I created a two-command alias wrapper for my batch file. The first command saved %$ to an environment variable, which the batch file could then use when called as the second command. I was trying to process numerical command-line arguments containing comma separators by removing the commas (and dollar signs, which I could do without any problem).
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,596
97
Albuquerque, NM
prospero.unm.edu
If you really want to see everything, you can examine the CMDLINE2 environment variable. But be warned, it really does contain everything everything. Multiple commands, redirection operators, variable references — everything.
 
Jun 2, 2008
388
2
Newton, MA
If I reference %cmdline2 in a batch file, the task hangs.

It looks as though I can use %@word[1-,%cmdline] to get the command tail as entered.
 

Similar threads