I would like to feed findstr with filenames without using the /f option, my script is like this:
@echo off
for /d /r %%d in (.) do dir /b /a-d "%%d"
And I want to check if a specific string exist in each file displayed by the dir command.
Thank you
What you are looking for is the option /F and its special value /, which reads the list of files to search from the console rather than from a file:
for /D /R %%d in (.) do dir /B /A:-D "%%d" | findstr /F:/ "search strings"
Since you are using the for loop just to return the directory tree, you could simply add switch /S to the dir command and dismiss the loop completely:
dir /B /S /A:-D | findstr /F:/ "search strings"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With