Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

search the path

Aug
258
4
Sometimes I wonder if I use the right version of a utility or script. And somtimes I can't remember the full name of an utility or script. To help me out of that, I have an alias "PFIND" that walks thru my path-directories and looks for matching files. Perhaps this could be useful for others, who have a pretty long path variable.
Code:
C:\Temp >alias ep
for /L %n in (0,1,%@dec[%@words[";",%path]]) echo %@word[";",%n,%path]
 
C:\Temp >alias pfind
for /t";" %p in (%path;D:\Downloads;%temp) if exist "%p"\*%@name[%1]*.*%@ext[%1]* pdir /p /(dy-m-d z fpn) "%p"\*%@name[%1]*.*%@ext[%1]*
 
C:\Temp >ep
C:\Program Files (x86)\VMware\VMware vSphere CLI\bin
C:\Program Files (x86)\VMware\VMware vSphere CLI\Perl\site\bin
C:\Program Files (x86)\VMware\VMware vSphere CLI\Perl\bin
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\Windows System Resource Manager\bin
\\company.de\net-ber\!Apps\Oracle\!instantclient_v11.2
C:\Program Files (x86)\Multimedia\QuickTime\QTSystem\
C:\Program Files\Netzwerk\NET-SNMP\bin
C:\Program Files (x86)\Tools\WinMerge
C:\Windows\SUA\common\
C:\Windows\SUA\usr\lib\
\\company.de\Net-BER\DV\Share\!w2kadm
\\company.de\net-ber\!admin\bin
 
C:\Temp >pfind find
2012-02-27           25514 C:\Program Files (x86)\VMware\VMware vSphere CLI\Perl\bin\find2perl.bat
2009-07-14           13824 C:\Windows\system32\find.exe
2009-07-14           58368 C:\Windows\system32\findnetprinters.dll
2010-11-21           62976 C:\Windows\system32\findstr.exe
2009-04-01          193536 C:\Windows\SUA\common\find.exe
2011-03-15         1274368 \\company.de\Net-BER\DV\Share\!w2kadm\AdFind.exe
2006-08-18          109509 \\company.de\Net-BER\DV\Share\!w2kadm\AdFind_131.pdf
2005-05-31             420 \\company.de\Net-BER\DV\Share\!w2kadm\find computer auf allen dcs.btm
2005-02-23             258 \\company.de\Net-BER\DV\Share\!w2kadm\find-dup-dns.btm
2007-08-15            1062 \\company.de\Net-BER\DV\Share\!w2kadm\find-office-ver.btm
2002-07-12             367 \\company.de\Net-BER\DV\Share\!w2kadm\find-vines-pcs.btm
2001-02-08             643 \\company.de\Net-BER\DV\Share\!w2kadm\finde_lokale_mailboxen.btm
2002-05-22             142 \\company.de\Net-BER\DV\Share\!w2kadm\findlogs.btm
2002-11-15          266240 \\company.de\Net-BER\DV\Share\!w2kadm\FindNBT.exe
2001-09-28          189440 \\company.de\Net-BER\DV\Share\!w2kadm\FindPDC.exe
1986-08-05            9445 \\company.de\Net-BER\DV\Share\!w2kadm\findstrw.com
1986-08-05            8273 \\company.de\Net-BER\DV\Share\!w2kadm\findstrw.doc
2003-06-26             240 \\company.de\Net-BER\DV\Share\!w2kadm\pst-find.btm
2010-04-26         1214976 \\company.de\net-ber\!admin\bin\AdFind.exe
2005-02-12          805376 \\company.de\net-ber\!admin\bin\AdFind_126.exe
2001-08-23           26112 \\company.de\net-ber\!admin\bin\findstr.exe
1986-08-05            9445 \\company.de\net-ber\!admin\bin\findstrw.com
1986-08-05            8273 \\company.de\net-ber\!admin\bin\findstrw.doc
1999-11-12           32528 \\company.de\net-ber\!admin\bin\regfind.exe
 
C:\Temp >pfind find.exe
2009-07-14           13824 C:\Windows\system32\find.exe
2010-11-21           62976 C:\Windows\system32\findstr.exe
2009-04-01          193536 C:\Windows\SUA\common\find.exe
2011-03-15         1274368 \\company.de\Net-BER\DV\Share\!w2kadm\AdFind.exe
2002-11-15          266240 \\company.de\Net-BER\DV\Share\!w2kadm\FindNBT.exe
2001-09-28          189440 \\company.de\Net-BER\DV\Share\!w2kadm\FindPDC.exe
2010-04-26         1214976 \\company.de\net-ber\!admin\bin\AdFind.exe
2005-02-12          805376 \\company.de\net-ber\!admin\bin\AdFind_126.exe
2001-08-23           26112 \\company.de\net-ber\!admin\bin\findstr.exe
1999-11-12           32528 \\company.de\net-ber\!admin\bin\regfind.exe
 
Hello Eric,

I'm happy you like them. For a while I use a simpler version of "echo path":

Code:
C:\...\TCCLE13x64 >alias ep
for /t";" %p in (%path) echo %p
 
There are so many different ways to do the same things. Gotta love TCC. Here is my (perhaps) even simpler version:
Code:
echo %@replace[;,^r^n,%PATH]

Michael
 
And, on a small note regarding "PF" (which is a truly wonderful alias, Frank!), depending on your preferences, I suppose, you might want to replace "EXIST' by "ISFILE" and add "/A-D" to the PDir command so that it doesn't show directories that match your pattern (I would virtually never be interested in seeing directories).
 
How about the simple "WHICH /A xxx" command? The first response is the default action of the command "xxx"; other alternatives already on your path are listed below. However, if the version you actually wanted is not already on your PATH, none of the methods above, nor WHICH /A will find it. Just the other day I wanted to execute the CYGWIN version of a command, but CYGWIN is not on my PATH, so I had to locate it. That's where FFIND can help! FFIND /D%@strip[: ,%_ready] xxx.exe;xxx.com will locate all executable files on all accessible drives which can be run by the "xxx" command.
 
thank you for these helpful suggestions.
 
Back
Top