Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This may be a stupid question but even after reading the documentation I'm still not sure how to find all lines in a file that contain either ".cpp" or ".h".

Is there a way to do that?

For example (doesn't work):

findstr /i .cpp,.h // , == OR
share|improve this question
up vote 4 down vote accepted

Give this a shot, should work for you.

findstr /i "\.cpp \.h" myfile.txt

Wrap both within quotes and separate with a space. Note, you also have to escape the . in both of them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.