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 command lines works running in cmd.exe:

findstr /l /i /s /c:"key=\"Smtp" *.config

However running in PowerShell 2 on Windows 7 Ultimate x64, findstr seems to freeze no matter which combination I use. I am searching a toy file I created (only one in folder) that has only this entry in it, so I know it's not just taking longer:

<add key="SmtpHost" value="localhost">

But these variations I tried never return in PowerShell (they also don't give the >> prompt to indicate an unterminated string).

findstr /l /i /s /c:"key=`"Smtp" *.config
findstr /l /i /s /c:"`"" *.config
findstr /l /i /s /c:"key=""Smtp" *.config
findstr /l /i /s /c:'key="Smtp' *.config

When I change it to use regular expressions, with a wild card, it will work:

findstr /r /i /s /c:"key=.Smtp" *.config

But how do I pass a double quote to findstr in PowerShell successfully?

share|improve this question
up vote 2 down vote accepted

Try this:

findstr /l /i /s /c:"key=\`"Smtp" *.config

you need to escape from both posh and \"`

more info here:

share|improve this answer
The key for escaping the double quote is \`" – Shrout1 Feb 24 at 17:25

Is there some functionality that you are getting from Findstr that you can't get from the Powershell cmdlets themselves?

Get-ChildItem .\* -Include *.config -Recurse | Select-String '"key="Smtp"'
share|improve this answer
That's a great meta-answer; removing the need for my original answer, and I'll probably use it (if I can figure out how to alias it into something nice). Still nice to know the literal answer, in case it ever comes up in another tool that PS can't so easily replace. – ZeroBugBounce Aug 18 '11 at 5:19

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.