Last active
April 1, 2018 04:34
-
-
Save impepc/bc8dc3ae84ceb7568806bf913f4a48b8 to your computer and use it in GitHub Desktop.
grep like find batch
This file contains 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 characters
@ECHO OFF | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
IF "%2" == "" (SET PWD="%CD%") ELSE (SET PWD=%~2) | |
FOR /F "delims=" %%f in ('dir /A-D /S /B "%PWD%"') DO ( | |
FINDSTR "%~1" "%%~f" > NUL | |
IF "!ERRORLEVEL!" == "0" | |
ECHO %%f | |
) | |
ENDLOCAL | |
@ECHO ON |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment