Q:

Nested for-loop, searching files

I have two files:
filetest.txt
============
SSISPACKAGE1.dtsx 
SSISPACKAGE2.dtsx 
SSISPACKAGE3.dtsx 
SSISPACKAGE4.dtsx 
SSISPACKAGE5.dtsx 
SSISPACKAGE6.dtsx 
SSISPACKAGE7.dtsx 
SSISPACKAGE8.dtsx 

filetest2.txt
=============
\\central_test_server\SSIS_Packages\Daily.bat
\\central_test_server\SSIS_Packages\Weekly.bat
\\central_test_server\SSIS_Packages\Monthly.bat
\\central_test_server\SSIS_Packages\Quarterly.bat
\\central_test_server\SSIS_Packages\SemiAnnually.bat
\\central_test_server\SSIS_Packages\Annually.bat

What I need is to cycle through filetest.txt, then search the files identified in 
filetest2.txt for the filename and output to a file the results.  I am trying to identify in well over 100 bat files where each of about 100 SSIS Packages are running.
I'm doing this in Windows batch, have tried about 20 various approaches without success - any help would be greatly appreciated.

A:

@ECHO OFF
SETLOCAL
(
 FOR /f "delims=" %%a IN (filetest.txt) DO (
  ECHO ===================== looking FOR %%a =====================
  FOR /f "delims=" %%s IN (filetest2.txt) DO (
   FINDSTR /m /i /l /c:"%%a" "%%s"
  ) 
 )
)>newfile.txt
GOTO :EOF

This should produce a file newfile.txt containing the required data.
If the real data in filetest.txt contains strings that are conducive to being a filename, then
@ECHO OFF
SETLOCAL
FOR /f "delims=" %%a IN (filetest.txt) DO (
 FOR /f "delims=" %%s IN (filetest2.txt) DO (
  FINDSTR /m /i /l /c:"%%a" "%%s"
 ) 
)>"%%a.new"
GOTO :EOF

may be preferred.

