If you used find
like that (without the full path) you most likely used the find.exe
that ships with Windows (C:\Windows\system32\find.exe
), which is more akin to grep
than to Unix find
. You get that behavior because Windows searches all directories in $env:PATH
for files with the given name (and one of the extensions listed in $env:PATHEXT
if no extension was specified), and executes the first match. Since %windir%\system32
is usually at the beginning of the PATH, executables from there take precedence.
You could add C:\msys64\msys64\usr\bin
to the beginning of the PATH (before %windir%\system32
), although I wouldn't recommend that. A better way would be to define an alias for the command:
New-Alias -Name 'find' -Value 'C:\msys64\msys64\usr\bin\find.exe'
Aliases take precedence over files. You could put the alias definition in your PowerShell profile so that it's automatically loaded whenever you start PowerShell.
Or you could simply use ls -r -fi '*.c'
(short for Get-ChildItem -Recurse -Filter '*.c'
), which would be the PowerShell way.