1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FFIND ERRORLEVEL

Discussion in 'Support' started by casterle, Apr 4, 2011.

  1. casterle

    Joined:
    Feb 11, 2011
    Messages:
    10
    Likes Received:
    0
    TCC 11.00.52

    I'm using FFIND to search text files for a string. I need to know if the string was found in any of the files - it doesn't matter which specific file contained the string.

    I expected that FFIND would set ERRORLEVEL (or _?) to indicate the presence or abserce of a match, but it doesn't seem to do so.

    Am I missing something? Is there another command which I can use to accomplish this?
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,732
    Likes Received:
    81
    FFIND only sets the errorlevel if there was an error -- and not finding a match is not considered an error.

    If you just want to check the results to see if anything matched, you can use the FFIND /U option. If you want to test it in a batch file, you can use @EXECSTR to return the FFIND result and parse that.
     
  3. casterle

    Joined:
    Feb 11, 2011
    Messages:
    10
    Likes Received:
    0
    Thanks for the quick answer.
     

Share This Page