FINDSTR
(find string)
在文件中寻找字符串。
FINDSTR
[/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/F:file]
        [/C:string] [/G:file] [/D:dir
list] [/A:color attributes]
[/OFF[LINE]]
        strings [[drive:][path]filename[ ...]]
  /B        在一行的开始配对模式。
  /E        在一行的结尾配对模式。
  /L        按字使用搜索字符串。
  /R        将搜索字符串作为一般表达式使用。
  /S        在当前目录和所有子目录中搜索
             
匹配文件。
  /I        
指定搜索不分大小写。
  /X        打印完全匹配的行。
  /V        只打印不包含匹配的行。
  /N        在匹配的每行前打印行数。
  /M        如果文件含有匹配项,只打印其文件名。
  /O        在每个匹配行前打印字符偏移量。
  /P        忽略有不可打印字符的文件。
  /OFF[LINE] 不跳过带有脱机属性集的文件。
  /A:attr   指定有十六进位数字的颜色属性。请见 "color /?"
  /F:file   从指定文件读文件列表 (/ 代表控制台)。
  /C:string 使用指定字符串作为文字搜索字符串。
  /G:file   从指定的文件获得搜索字符串。 (/ 代表控制台)。
  /D:dir    查找以分号为分隔符的目录列表
  strings   要查找的文字。
  [drive:][path]filename
           
指定要查找的文件。
除非参数有 /C 前缀,请使用空格隔开搜索字符串。
例如: 'FINDSTR "hello
there" x.y' 在文件 x.y 中寻找 "hello" 或"there" 。  'FINDSTR /C:"hello
there" x.y' 文件 x.y  寻找"hello there"。
一般表达式的快速参考:
  .        通配符: 任何字符
  *        重复: 以前字符或类别出现零或零以上次数
  ^        行位置: 行的开始
  $        行位置: 行的终点
  [class]  字符类别:
任何在字符集中的字符
  [^class] 补字符类别:
任何不在字符集中的字符
  [x-y]    范围: 在指定范围内的任何字符
  \x       Escape: 元字符 x 的文字用法
  \<xyz    字位置: 字的开始
  xyz\>    字位置: 字的结束
有关 FINDSTR 常见表达法的详细情况,请见联机命令参考。
Searches for strings in files.
FINDSTR
[/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
        [/C:string] [/G:file] [/D:dir
list] [/A:color attributes]
[/OFF[LINE]]
        strings [[drive:][path]filename[ ...]]
  /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
            
subdirectories.
  /I        
Specifies that the search is not to be
case-sensitive.
  /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.
  /M        
Prints only the filename if a file contains a match.
  /O        
Prints character offset before each matching line.
  /P        
Skip files with non-printable characters.
  /OFF[LINE] Do
not skip files with offline attribute set.
  /A:attr    Specifies color attribute
with two hex digits. See "color /?"
  /F:file    Reads file list from the
specified file(/ stands for console).
  /C:string  Uses specified string as a literal
search string.
  /G:file    Gets search strings from the
specified file(/ stands for console).
  /D:dir     Search a semicolon
delimited list of directories
  strings    Text to be searched for.
  [drive:][path]filename
            
Specifies a file or files to search.
Use
spaces to separate multiple search strings unless the argument is prefixed with
/C.  For example, 'FINDSTR
"hello there" x.y' searches for
"hello" or "there" in file x.y.  'FINDSTR /C:"hello
there" x.y' searches for "hello there"
in file x.y.
Regular
expression quick reference:
  .       
Wildcard: any character
  *       
Repeat: zero or more occurances of previous
character or class
  ^        Line
position: beginning of line
  $        Line
position: end of line
  [class]  Character class: any one character in
set
  [^class] Inverse class: any one
character not in set
  [x-y]    Range: any characters within
the specified range
  \x       Escape:
literal use of metacharacter x
  \<xyz    Word position: beginning of
word
  xyz\>    Word position: end of word
For
full information on FINDSTR regular expressions refer to the online Command Reference.