Windows Grep supports an extensive command line interface that enables it to be run from a command line similarly to running the DOS or UNIX versions of grep utilities.
The command line takes two forms:
GREP32 -F<.PAR filename>
This form will instruct Windows Grep to load the specified PAR file and begin the search immediately. PAR files are Windows Grep parameter files and are created when search parameters are saved using File Save. See Format of .PAR files for more information on the format and use of these. This must be a full path and filename, such as "C:\windows grep\my search.par". Remember to enclose it in double-quotes (") if it contains spaces. (Note: A file association for .PAR files is set up to allow them to be double-clicked on in Explorer)
GREP32 [<options>...] <string> <filespec> [<folder>]
Parameters enclosed in [ ] are optional.
<options> may be one of the following characters, upper or lower case, preceded by a - or /.
Whole words only
Count Files First
To turn off a particular option, follow the character with a -.
There may be multiple options on the command line separated by spaces.
-R -W- /C-
means recurse subfolders, not whole words only and don't count first. If no options are specified, or not all five are used, the value(s) used during the last search are used.
<string>, <filespec> and <folder> behave exactly as you would expect. The <folder> is optional and if omitted the search will commence in the current directory. These parameters may contain spaces, but must be enclosed in double-quotes (") if they do. Multiple file and directory specifications are not supported in this release.
Command line examples
c:\windows> grep32 -r -C- Windows *.ini
Search all *.ini files for the string Windows in the current directory (c:\windows). Recurse subfolders, but don't count files first.
c:\windows> grep32 -r- -W Grep *.pas "c:\Delphi Work\Windows Grep"
Search all *.pas files for the string Grep in folder c:\delphi work\Windows Grep, but don't recurse subfolders and find whole words only.