1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Get-Alias

Discussion in 'T&T - Scripting' started by Joe Caverly, Oct 29, 2009.

  1. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    680
    Likes Received:
    8
    Hi,
    While TCC has the ALIAS command to list all currently defined aliases, I find it a bit difficult to read. I have written a simple batch file that lists all currently defined aliases in two columns.

    Code:
    @setlocal
    @if %_echo eq 1 @echo off
    if %@len[%@alias[%1]] eq 0 goto showall
    if %@len[%@alias[%1]] gt 0 goto showit
    goto eoj
    
    :showit
    gosub headers
    screen %_row  0 %1
    screen %_row 16 %@alias[%1]
    goto eoj
    
    :showall
    gosub headers
    alias > clip:
    setdos /X-45678
    do theline in @clip:
      screen %_row  0 %@word["=",0,%theline]
      screen %_row 16 %@alias[%@word["=",0,%theline]]
      ::
      :: If your aliases are too long, you could un-comment the following line;
      ::
      ::screen %_row 16 %@left[60,%@word["=",1,%theline]]
      ::
      echo.
    enddo
    setdos /X0
    goto eoj
    
    :headers
    screen %_row  0 Name
    screen %_row 16 Definition
    echo.
    screen %_row  0 ----
    screen %_row 16 ----------
    echo.
    return
    
    :eoj
    endlocal
    
    
     
  2. Kachupp

    Joined:
    Aug 9, 2009
    Messages:
    133
    Likes Received:
    0
    alias | list /sn
    not as easy to read but you get use to it

    ----- Original Message -----
    From: "Joe Caverly" <>
    To: <kachupp@gmail.com>
    Sent: Friday, October 30, 2009 2:45 PM
    Subject: [T&T - Scripting-t-1523] Get-Alias



     
  3. Peter Murschall

    Joined:
    Sep 3, 2010
    Messages:
    36
    Likes Received:
    0
    My 2 Cents:
    Alias ShowAlias=ALIAS | SORT | LIST /s
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    I would provide choice to list subsets:
    Alias ShowAlias=`*ALIAS %$ | SORT | LIST /s `
    (cmd style)
    Alias ShowAlias=`*ALIAS %$& | SORT | LIST /s `
    (4DOS style)
    Notice the * in front of ALIAS so it could work on anyone's system, even if they already have a different definition of ALIAS...
     

Share This Page