Clear alias parameters

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,667
46
Albuquerque, NM
prospero.unm.edu
#4
After deleting a file by mistake, I read the Help and learned that alias parameters above the last one referenced get appended to the command line. So, I'm adding "echos %511 > nul %+" to the front of aliases where this shouldn't happen. Is there something shorter that I could use?
How about %+ REM ? Ignoring stuff is its raison d'etre.
 
#5
Thanks. That's better than the suggestion in the Help.

As to what I'm trying to do, see the Help for ALIAS, the paragraph ending "A convenient way to prevent unwanted command line parameters from being appended is to add a reference to %511 within the alias." I had an alias that was something like "foo %1 %+ erase bar.txt", and I mistakenly called it with two parameters.
 
#6
Thanks. That's better than the suggestion in the Help.

As to what I'm trying to do, see the Help for ALIAS, the paragraph ending "A convenient way to prevent unwanted command line parameters from being appended is to add a reference to %511 within the alias." I had an alias that was something like "foo %1 %+ erase bar.txt", and I mistakenly called it with two parameters.
Actually, the %511 doesn't require its own command. It will have the desired effect as long as it's referenced anywhere in the alias. Using your example, "foo %1 %+ erase bar%511" would work unless you accidentally put 510 extra parameters on the command line.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,667
46
Albuquerque, NM
prospero.unm.edu
#7
I don't love the %511 approach, because Rex does occasionally increase things like buffer sizes, maximum number of arguments, and so on. Which is totally anal of me, since I'm never going to put that many args on a command line anyway.