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

WHICH?

Discussion in 'Support' started by vefatica, Jun 6, 2011.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,782
    Likes Received:
    29
    Is this the expected behavior of WHICH?

    Code:
    v:\> which wmiu*
    wmiu* is an external : D:\uty\wmiu*.exe
    
    v:\> u:\wmiuptime.exe
    
    Time:   2011/06/06  23:37:11
    Boot:   2011/04/23  16:35:59
    Uptime: 44 days 3 hours 1 minute 12 seconds
     
  2. ebbe

    Joined:
    Jun 2, 2008
    Messages:
    31
    Likes Received:
    0
    First off, I'm on TCC 10,00,78. Things may have changed since then.

    Have you tried this:
    Code:
    which /a wmiu*
    
     
  3. dim

    dim Dimitry Andric

    Joined:
    May 31, 2008
    Messages:
    202
    Likes Received:
    0
    On 2011-06-07 05:39, vefatica wrote:

    If u:\ isn't in your PATH, and D:\uty is, then yes.
     
  4. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    560
    Likes Received:
    8
    On the same lines, WHICH (sorry, couldn't resist) is first in your PATH list?
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,782
    Likes Received:
    29
    On Tue, 07 Jun 2011 03:58:38 -0400, dim <> wrote:

    |If u:\ isn't in your PATH, and D:\uty is, then yes.

    u:\ and d:\uty are the same thing (SUBST). I should have conducted the test
    like this. Sorry for the confusion.

    Code:
    v:\> which wmiu*
    wmiu* is an external : D:\uty\wmiu*.exe
    
    v:\> which /a wmiu*
    wmiu* is an external : D:\uty\wmiuptime.exe
    
    v:\> d:\uty\wmiuptime.exe
    
    Time:   2011/06/07  10:13:15
    Boot:   2011/04/23  16:35:59
    Uptime: 44 days 13 hours 37 minutes 16 seconds
    It's the presence of the "*" when WHICH names the file that I'm wondering about.
    I figured it would give the actual name of the match as it does with "/A".
     
  6. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    ---- Original Message ----
    From: vefatica
    To: ESFabian@zenge.org
    Sent: Tuesday, 2011. June 7. 10:25
    Subject: RE: [Support-t-2914] WHICH?

    | On Tue, 07 Jun 2011 03:58:38 -0400, dim <> wrote:
    |
    || If u:\ isn't in your PATH, and D:\uty is, then yes.
    |
    | u:\ and d:\uty are the same thing (SUBST). I should have conducted
    | the test
    | like this. Sorry for the confusion.
    |
    |
    | Code:
    | v:\> which wmiu*
    | wmiu* is an external : D:\uty\wmiu*.exe
    |
    | v:\> which /a wmiu*
    | wmiu* is an external : D:\uty\wmiuptime.exe
    |
    | v:\> d:\uty\wmiuptime.exe
    |
    | Time: 2011/06/07 10:13:15
    | Boot: 2011/04/23 16:35:59
    | Uptime: 44 days 13 hours 37 minutes 16 seconds

    | It's the presence of
    | the "*" when WHICH names the file that I'm wondering about.
    | I figured it would give the actual name of the match as it does with
    | "/A".

    I found similar behavior.


    command is an external : C:\WINDOWS\system32\command.com

    command is an external : C:\WINDOWS\system32\command.com

    comman* is an external : C:\WINDOWS\system32\comman*.com

    comman* is an external : C:\WINDOWS\system32\comman*.com

    comma* is an external : C:\WINDOWS\system32\comma*.com

    comma* is an external : C:\WINDOWS\system32\comma*.com

    comman? is an external : C:\WINDOWS\system32\comman?.com

    comman? is an external : C:\WINDOWS\system32\comman?.com

    comma?? is an external : C:\WINDOWS\system32\comma??.com

    comma?? is an external : C:\WINDOWS\system32\comma??.com

    com*nd is an external : C:\WINDOWS\system32\com*nd.com

    I found similar behavior with @SEARCH[]:


    C:\WINDOWS\system32\com*nd.com

    I finally got a correct result thus:


    C:\WINDOWS\system32\command.com

    I also run a test: "which /a new?al"; it listed all aliases matching the ? with their unique names and definitions, and listed the matching batchfile thus:

    new?al is a batch file : F:\LOC\NEWBAL.BTM

    Summary
    - Wildcards are properly expanded in alias names and correct values listed
    - If the wildcard matches more than one FILE (batch or external) the WHICH parameter retains the wildcard, but the real filenames are displayed
    - If the wildcard matches one file, WHICH /A sometimes reports the file with wildcard in its name, sometimes with real names(each instance repeatable, rule not discovered); without /A always with wildcard.

    IMHO filenames reported should never contain wildcards!
    --
    Steve
     
  7. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    646
    Likes Received:
    1
    The Help says, "WHICH does not support wildcard specifications unless you use the /A option." So, maybe you shouldn't do that.
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    Yes. If you want to use wildcards, you have to use /A.

    Rex Conn
    JP Software
     
  9. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,782
    Likes Received:
    29
    OK, fair enough. But Steve's post seems to suggest he saw wildcards in the output filename even when he used "/A" (I can't reproduce that).
     
  10. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,782
    Likes Received:
    29
    [Steve first pointed this out]. Is this expected behavior?

    Code:
    v:\> echo %@search[comman*]
    C:\WINDOWS\system32\comman*.com
     
  11. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,726
    Likes Received:
    80
    Yes -- see the help.

    Rex Conn
    JP Software
     
  12. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,782
    Likes Received:
    29
    On Tue, 07 Jun 2011 23:23:18 -0400, rconn <> wrote:

    |---Quote---
    |> [Steve first pointed this out]. Is this
    |> expected behavior?
    |---End Quote---
    |Yes -- see the help.

    Missed that. But it is peculiar behavior
     

Share This Page