Expand all aliases on the command line

Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  25.00.20 x64   Windows 10 [Version 10.0.18362.356]

I have the following aliases;
Code:
e:\utils>alias cscript64
C:\Windows\system32\cscript.exe //nologo %$

e:\utils>alias vbs64
%@if[%# eq 0,dir *.vbs,cscript64]

If I run the command;
Code:
vbs64 math.vbs
...and expand it on the command line by pressing Ctrl-W...
Code:
e:\utils>%@if[1 eq 0,dir *.vbs,cscript64 //nologo] math.vbs
...why is the cscript64 alias not expanded?

Joe
 

rconn

Administrator
Staff member
May 14, 2008
11,952
133
Ctrl- W only expands aliases at the beginning of the command line or following a command separator.

To expand aliases inside an @IF would require the command line editor to execute the command line and evaluate the result. That's outside the editor's scope, and would introduce a host of new problems.
 
  • Like
Reactions: nikbackm