Created
February 7, 2024 10:46
-
-
Save brovish/c43da704c63983034c4f8baf66721ac4 to your computer and use it in GitHub Desktop.
Revisions
-
brovish created this gist
Feb 7, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ @echo off setlocal EnableDelayedExpansion if "%~3"=="" ( echo Incorrect usage. The correct usage is: %~nx0 "Search Directory" "Filename Pattern" "Search String" exit /b ) set "SEARCH_DIR=%~1" set "FILENAME_PATTERN=%~2" set "SEARCH_STRING=%~3" set "TEMP_FILE=%TEMP%\filelist.txt" dir /S /B "%SEARCH_DIR%\%FILENAME_PATTERN%" > "%TEMP_FILE%" for /F "delims=" %%F in (%TEMP_FILE%) do ( findstr /M /I /C:"%SEARCH_STRING%" "%%F" >nul if !errorlevel! equ 0 ( echo Contains string: "%%F" ) else ( echo Does not contain string: "%%F" ) ) del "%TEMP_FILE%" endlocal