Index | Examples | Syntax FIND | SORT | MORE | Batch


Specifying a string Unless you specify the /I switch, FIND searches for exactly what you specify for string. For example, to the FIND command the characters "a" and "A" are different. If you were to use the /I switch, however, FIND would ignore case and search for "a" and "A" as if they were the same character. If the string you want to search for contains quotation marks, you must use two quotation marks for each quotation mark contained within the string. Using FIND as a filter If you omit a filename, FIND acts as a filter, taking input from the MS-DOS standard source (usually the keyboard, a pipe, or a redirected file) and displaying any lines that contain the string. Using wildcards with FIND You cannot use wildcards (* and ?) in filenames or extensions that you specify with the FIND command. To search for a string in a set of files you specify with wildcards, you can use the FIND command in a FOR command. Using the /V or /N switch with the /C switch If you specify the /C and /V switches in the same command, FIND displays a count of the lines that do not contain the specified string. If you specify the /C and /N switches in the same command, FIND ignores the /N switch. Using FIND in files with carriage returns The FIND command does not recognize carriage returns. When you use FIND to search for text in a file that includes carriage returns, you must limit the search string to text that can be found between carriage returns--that is, a string that is not likely to be interrupted by a carriage return. For example, FIND does not report a match for the string "tax file" wherever a carriage return occurs between the word "tax" and the word "file". FIND exit codes The following list shows each exit code and a brief description of its meaning: 0 The search was completed successfully and at least one match was found. 1 The search was completed successfully, but no matches were found. 2 The search was not completed successfully. In this case, an error occurred, and FIND cannot report whether any matches were found. You can use the ERRORLEVEL parameter on the <If> command line in a batch program to process exit codes returned by FIND: If (%1)==() @Echo Syntax: %0 filename If Exist %1 Type %1 | Find/v "" > Nul If Exist %1 If errorlevel 1 If not errorlevel 2 Edit %1
-Top- | Examples | Syntax FIND | SORT | MORE | Batch

Search for
Get a Free Search Engine for Your Web Site






Hidden section:


Or  And   Exact    

   Quotes can only be used when the "any" radio button is selected.
   A phrase must be contained within quotation marks,
   "if not errorlevel"

   Wildcard *+- is ok but only if the "any" radio button is selected.

   +ba* -pr*gram will find all pages which have a word that starts
                 with ba and which does not contain a word that
                 starts with pr and ends with gram.
   "wh* are" will find the phrases where are, what are, why are, etc.

   ba* +*level* -*ormat will find batch file(s) and levels but not format   

   Lowercase words will match any case.

   Use similar words. The more similar words you use in a search,
                      the more relevant results you'll get back.
   safe secure privacy security

   Field searches allow you to create specific searches for words
                  that appear in a specific part of a document.

     Indexed: Sept 23, 03. It took 4 minutes to crawl and index 445
     pages containing 351.145 words for a total of 2.185.310 bytes,
     10.815 word endings & 22.635 sounds-alike words were included.
     My statistics counter is counting about 1600 hits each day but
     only 879 in a weekend, so, hmmmm, I wonder what about they are
     doing when it's Saturday?

Benny Pedersen

Benny Pedersen
     I live in Kolding, upstairs in a white house (no 28). There is
     a railway outside my windows, puff puff.

     Here's a hidden batch page (pro tempore no link, except this.)
     You can find some stuff about WindowsNT/XP, here: News Page 9.