I'm trying to use findstr
to search inside a folder looking for some string:
findstr /spin /c:"string" *
however it returns back with a lot of Cannot open
errors which make it difficult for me to find the exact matches found.
When using Cmder
command:
grep -r "string" .
I got Permission denied
error for the same folders. If I use the command:
grep -rs "string" .
it gives me the results nice and clean. Is there a similar flag for findstr
or a combination of cmd
commands to do the same?
there are already some posts for findstr
Cannot open
error, explaining what is wrong and how to solve it, but I don't care why it is happening. I just want the command to ignore the Cannot open
lines and prints out just the lines with exact matches.
You can make use of 2>nul
:
FINDSTR /SPIN /C:"string" * 2>nul
This will pipe the standard-error stream to null (read more), thus only matches are displayed.