4

I want to run a FINDSTR dos command in a way beyond what it is easily found in "findstr /?". How would I run findstr so that it only searches ascii files. (I am not sure if that is possible. My gut feeling is that it is not possible) Additionally, how would I run this command line so that it would exclude some file times. For example, what if I wanted to exclude .psd files

xarzu
  • 8,657
  • 40
  • 108
  • 160

1 Answers1

8

What is wrong with the /P option that is described in the help?

/P         Skip files with non-printable characters.

It worked for me.

To take further control of which files are searched, simply iterate the files with a for loop and add whatever logic you need. To skip .psd files and also skip binary files:

for /f "eol=: delims=" %%F in ('dir /a-d /b^|findstr /live ".psd"') do findstr /p "search" "%%F"

Use a single percent instead of double percents if run from the command line.

dbenham
  • 127,446
  • 28
  • 251
  • 390