WHICH?

May 20, 2008
12,332
134
Syracuse, NY, USA
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
 
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
First off, I'm on TCC 10,00,78. Things may have changed since then.

Have you tried this:
Code:
which /a wmiu*
 
On 2011-06-07 05:39, vefatica wrote:

> 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
> ---------

If u:\ isn't in your PATH, and D:\uty is, then yes.
 
If u:\ isn't in your PATH, and D:\uty is, then yes.
On the same lines, WHICH (sorry, couldn't resist) is first in your PATH list?
 
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".
 
---- Original Message ----
From: vefatica
To: [email protected]
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.


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

> which /a command
command is an external : C:\WINDOWS\system32\command.com

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

> which /a comman*
comman* is an external : C:\WINDOWS\system32\comman*.com

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

> which /a comma*
comma* is an external : C:\WINDOWS\system32\comma*.com

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

> which /a comman?
comman? is an external : C:\WINDOWS\system32\comman?.com

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

> which /a comma??
comma?? is an external : C:\WINDOWS\system32\comma??.com

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

I found similar behavior with @SEARCH[]:


> echo %@search[com*nd]
C:\WINDOWS\system32\com*nd.com

I finally got a correct result thus:


> echo %@expand[%@search[com*nd]]
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
 
The Help says, "WHICH does not support wildcard specifications unless you use the /A option." So, maybe you shouldn't do that.

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).
 
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