extending PATH on Windows?

eryk sun eryksun at gmail.com
Fri Feb 19 13:04:29 EST 2016


On Fri, Feb 19, 2016 at 4:48 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Fri, Feb 19, 2016 at 9:42 PM, Ulli Horlacher
> <framstag at rus.uni-stuttgart.de> wrote:
>> pyotr filipivich <phamp at mindspring.com> wrote:
>>
>>> >       Windows (especially 7) search function is highly crippled. There is
>>> >some command sequence that will open it up to looking at other file types
>>> >and locations.
>>> >
>>> >http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-search-does-not-find-files-that-it/61b88d5e-7df7-4427-8a2e-82b801a4a746?auth=1
>>>
>>>
>>> Thanks.  I've found it "simpler" to just open a command prompt, and
>>> use DOS.
>>
>> How can one search for files with DOS?
>
> dir /s /b \*add2path.*

This search is carried out by Windows NT instead of MS-DOS in almost
all cases nowadays:

    Z:\Python\repo\2.7>dir /s /b Tools\Scripts\win_add?*.*
    Breakpoint 0 hit
    ntdll!NtQueryDirectoryFile:
    00007ffb`d9d138c0 4c8bd1          mov     r10,rcx

    0:000> dS poi(@rsp + a*8)
    000000df`bab1ff9a  "win_add><"*"

NT has normal (i.e. sane) * and ? wildcard matching, so WinAPI
FindFirstFile has to translate DOS wildcards to special values before
calling NtQueryDirectoryFile. See the file-system runtime library
function FsRtlIsNameInExpression [1]. Dot, question mark, and asterisk
may be mapped (depending on context in the string) to double quote and
the angle brackets, as shown in the above debugger output in which
'win_add?*.*' is passed to the system call as 'win_add><"*'.

    DOS_DOT (")
    Matches either a period or zero characters beyond the
    name string.

    DOS_QM (>)
    Matches any single character or, upon encountering a
    period or end of name string, advances the expression
    to the end of the set of contiguous DOS_QMs.

    DOS_STAR (<)
    Matches zero or more characters until encountering
    and matching the final . in the name.

[1]: https://msdn.microsoft.com/en-us/library/ff546850


More information about the Python-list mailing list