home *** CD-ROM | disk | FTP | other *** search
- @ECHO OFF
- REM This is FINDTEXT.BAT
- REM
- REM FINDTEXT.BAT will search through all files in the current directory
- REM for single text words you specify and show you the names of all the
- REM files you searched preceded by a set of dashes. For those files
- REM containing the search text, it will also display each line (and the
- REM line number) that contains this text.
- REM It will also let you narrow the search by entering a custom filespec
- REM at the end of the line. FINDTEXT Birthday *.TXT would limit the search
- REM for "Birthbay" to files with .TXT extensions. If you entered just
- REM FINDTEXT Birthday, FINDTEXT would look inside every file in the directory.
- REM
- SET FLS=*.*
- IF %1!==! GOTO OOPS
- IF %2!==! GOTO START
- SET FLS=%2
- :START
- ECHO Searching for text %1 . . .
- FOR %%A IN (%FLS%) DO FIND /N "%1" %%A
- GOTO END
- :OOPS
- ECHO Enter the text you want to
- ECHO search for in the current
- ECHO directory after the %0
- ECHO.
- ECHO If you want, follow %0 and the
- ECHO text you want to search with a
- ECHO filespec such as *.BAT or *.TXT
- ECHO.
- ECHO Otherwise this will search *.*
- :END
- SET FLS=