9

findstr /S "stored procedure" *.*

returns all the files with the string "stored" as opposed to "stored procedure".

Does anyone know what I am doing wrong? Thanks

Raymond Chen
  • 44,448
  • 11
  • 96
  • 135
user1298925
  • 2,304
  • 7
  • 29
  • 43
  • Duplicate of [How to write a search pattern to include a space in findstr?](http://stackoverflow.com/questions/9789563/how-to-write-a-search-pattern-to-include-a-space-in-findstr). – Raymond Chen May 24 '13 at 20:43

1 Answers1

15

You need to use the /c: option to tell findstr to search for the entire string not to search for individual components. Your command will find any file with "stored" or "procedure".

findstr /S /c:"stored procedure" *.*

Will find any files with the string "stored procedure" in them.

shf301
  • 31,086
  • 2
  • 52
  • 86
  • Thank you, I will mark it as a answer as soon as I am allowed to. – user1298925 May 24 '13 at 17:42
  • 1
    @Mark Ransom, Ken White, Raymond Chen, Roger Rowland, Mario I wish I knew why this question is marked as off topic but the duplicate one is not. Raymond Chen references the duplicate one as my answer yet that one is not off topic but my question is. I would appreciate a descriptive reason why there is a difference between these two questions so that from now on I would not post off topic questions. Thanks – user1298925 May 28 '13 at 13:59
  • @user1298925 - I suspect that at least one of the close votes was for the reason of it being a duplicate question. I also don't see how the question is off topic, but it makes sense to close as a duplicate. I believe a limitation with the close process causes it to list the first received reason for closure, even if the majority of subsequent votes are for a different reason. – dbenham May 28 '13 at 14:27