extending PATH on Windows?

eryk sun eryksun at gmail.com
Fri Feb 19 13:42:41 EST 2016


On Fri, Feb 19, 2016 at 8:18 AM, Gisle Vanem <gvanem at yahoo.no> wrote:
> Dennis Lee Bieber wrote:
>
>>>> How can one search for files with DOS?
>>>
>>> dir /s /b \*add2path.*
>>>
>>> ChrisA
>>
>>       Or move to PowerShell...
>>
>> Windows PowerShell
>> Copyright (C) 2009 Microsoft Corporation. All rights reserved.
>>
>> PS C:\Users\Wulfraed\Documents> Get-ChildItem -Path c:\ -Filter *add2path*
>> -Name -Recurse
>
> Clumsy IMHO. Try:
> c:\> envtool --path *ipython*
>
> Matches in %PATH:

Your tool has special integration with Python's search paths, which is
cool. But for someone that wants some of these features without
installing another program and without learning PowerShell, where.exe
may suffice:

    https://technet.microsoft.com/en-us/library/cc753148

Search PATH and the current directory:

    C:\>where kd
    C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\kd.exe

Search an environment variable that may contain one or more directories:

    C:\>set MYPATH=^
    More? %SystemRoot%\System32;^
    More? %SystemRoot%\System32\drivers

    C:\>where $MYPATH:conhost*.*
    C:\Windows\System32\conhost.exe
    C:\Windows\System32\ConhostV1.dll
    C:\Windows\System32\ConhostV2.dll

Search a list of directories:

    C:\>where "%MYPATH%":con*.sys
    C:\Windows\System32\drivers\condrv.sys

Recursively search a directory:

    C:\>where /r "%LocalAppData%\Programs" python.exe
    C:\Users\Administrator\AppData\Local\Programs\Python\
        Python35-32\python.exe


More information about the Python-list mailing list