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

Where am I going wrong with ALIAS???

Discussion in 'Support' started by mathewsdw, Mar 12, 2011.

  1. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Not having used the "Alias" command much, I decided to use it more because it could, as is its main purpose, save me some typing. However, I have been totally unsuccessful in getting any of my new aliases to work correctly. Here's a sample test alias I made:

    Ac*tualFiles=D:\DOS\StartX ActualFiles

    Here's the full content of D:\DOS\StartX.bat (it's a batch rather than .btm file purely for testing purposes):

    @Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

    And here's the result:

    D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
    EchoArgs
    D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
    EchoArgs
    D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
    EchoArgs

    displayed over and over and over again in an infinite loop. All of my other aliases result in a variation on the same theme (only differing in the name of the batch file that is being invoked and possibly the parameter(s) that are being used), all of which batch files, for testing purposes, have the same content as the above. I must admit I am totally bamboozled at this point...
     
  2. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    560
    Likes Received:
    8
    The problem is with the alias, not the batch file. The alias appears to be self-referential, calling itself after calling the StartX batch file. Changing it to the following should fix it.
    Code:
    Ac*tualFiles=D:\DOS\StartX
    
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    It would seem there's something you're not telling us. Where did EchoArgs come
    from? Anyway, it works OK for me:

    Code:
    v:\> type startx.bat
    @Echo %1 %2 %3 %4 %5 %6 %7 %8 %9
    
    v:\> alias actualfiles
    v:\StartX ActualFiles
    
    v:\> actualfiles
    ActualFiles
    On Sat, 12 Mar 2011 23:32:43 -0500, mathewsdw <> wrote:

    |Not having used the "Alias" command much, I decided to use it more because it could, as is its main purpose, save me some typing. However, I have been *totally* unsuccessful in getting *any* of my new aliases to work correctly. Here's a sample test alias I made:
    |
    |Ac*tualFiles=D:\DOS\StartX ActualFiles
    |
    |Here's the full content of D:\DOS\StartX.bat (it's a batch rather than .btm file purely for testing purposes):
    |
    |@Echo %1 %2 %3 %4 %5 %6 %7 %8 %9
    |
    |And here's the result:
    |
    |D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
    |EchoArgs
    |D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
    |EchoArgs
    |D:\DOS\StartX EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs EchoArgs
    |EchoArgs
    |
    |displayed over and over and over again in an infinite loop. All of my other aliases result in a variation on the same theme (only differing in the name of the batch file that is being invoked and possibly the parameter(s) that are being used), all of which batch files, for testing purposes, have the same content as the above. I must admit I am totally bamboozled at this point...
     
  4. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    On Sun, 13 Mar 2011 05:00:28 -0400, mathewsdw <> wrote:

    |Code:
    |---------
    |Fin*dSong=Start D:\DOS\StartX FindSong
    |---------
    |if the line is in the loaded "Alias" file, the result of
    |Code:
    |---------
    |dir | Find "Alias"
    |---------
    | is:
    |Code:
    |---------
    |TCC: (Sys) The system cannot find the file specified.
    | "D:\DOS\StartX"
    |---------

    That one is OK here also, doing what I'd expect it to do.

    Code:
    v:\> type startx.bat
    @Echo %1 %2 %3 %4 %5 %6 %7 %8 %9
    
    v:\> alias | grepp FindS
    Fin*dSong=v:\StartX FindSong
    
    v:\> dir | find "Alias"
    FindSong "Alias"
     
  6. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Vince, I just clarified my previous posting, you might want to re-read it. However, I stand by my issue that that does not work for me (I just now tried it again), but maybe it's a mute point by now...
     
  7. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    646
    Likes Received:
    1
    Works for me:

    C:\Junk>alias Ac*tualFiles=c:\junk\StartX ActualFiles

    C:\Junk>ac
    ActualFiles

    C:\Junk>actualfiles
    ActualFiles

    C:\Junk>type StartX.bat
    @Echo %1 %2 %3 %4 %5 %6 %7 %8 %9

    C:\Junk>

    TCC 12.01.44 Windows Vista [Version 6.0.6002]
     
  8. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    Thanks! I tried a number of things and I'm not sure what fixed it (bad memory again; it's getting almost critical), but something fixed it. I wish I could be more specific, but it is no longer a problem (which is the important thing)....
     

Share This Page