Take the 2-minute tour ×

I'd like to do something like "dsquery * | grep asdf" on a Windows machine that I can't install anything on. Any ideas?

Thank you.

share|improve this question
Good question; I always wondered if Windows had an equivalent. –  J. Polfer May 14 '09 at 15:29
add comment

4 Answers

up vote 15 down vote accepted


dsquery * | findstr "asdf"

share|improve this answer
add comment

The findstr command is what you're looking for. It's a little different than grep, but you can do some of the same things.

    C:\Working>findstr /?
    Searches for strings in files.


      /B         Matches pattern if at the beginning of a line.
      /E         Matches pattern if at the end of a line.
      /L         Uses search strings literally.
      /R         Uses search strings as regular expressions.
      /S         Searches for matching files in the current directory and all
      /X         Prints lines that match exactly.
      /V         Prints only lines that do not contain a match.
      /N         Prints the line number before each line that matches.
      /O         Prints character offset before each matching line.
      /P         Skip files with non-printable characters.
      /C:string  Uses specified string as a literal search string.
      /D:dir     Search a semicolon delimited list of directories
      strings    Text to be searched for.
                 Specifies a file or files to search.

    Use spaces to separate multiple search strings unless the argument is prefixed
    "hello there" in file x.y.

    Regular expression quick reference:
      .        Wildcard: any character
      *        Repeat: zero or more occurrences of previous character or class
      ^        Line position: beginning of line
      $        Line position: end of line
      [class]  Character class: any one character in set
      \x       Escape: literal use of metacharacter x
      \    Word position: end of word

    For full information on FINDSTR regular expressions refer to the online Command
share|improve this answer
+1, but any chance you can turn off the syntax highlighting? –  Simon Nickerson May 14 '09 at 15:41
i'd be happy to - do you know how to do that while still keeping it in a code block? thx! –  Mike May 14 '09 at 16:41
You can put it inside <pre> tags –  Simon Nickerson May 20 '09 at 7:51
thx simonn! formatting has been changed –  Mike May 20 '09 at 14:43
add comment
dsquery * | find "asdf"
share|improve this answer
add comment

"find" appears since DOS ages. "findstr" is newer and feature richer than "find"

share|improve this answer
add comment

Your Answer


