loops - Batch find certain filenames then use the names in variable -


i need script first finds files in directory string, uses filenames in variable used in script. so:

  1. find files , filenames
  2. saves file?
  3. start kind of loop? changes variable executes belonging script
  4. repeat till filenames have been used.

my code here..

@echo off  /r c:\work %%g in (*) @findstr /m /s "string" > filenames.txt %%g set var1=0 %%g in (*) ( var1=<filenames.txt (???) script script 

i haven't writen "script" myself , friend me it, if see need wait until can other computer @ home.

thanks on beforehand!

  1. find files , filenames
  2. saves file
set "search=what want find" (for /f "delims=" %%a in ('dir /a-d /b /s "c:\work" ^| findstr "%search%"') echo (%%~fa)>filenames.txt 
  1. start kind of loop? changes variable executes belonging script
  2. repeat till filenames have been used.
for /f "delims=" %%a in (filenames.txt) (   rem here inside loop   rem until file names filenames.txt processed ) 

Comments