title: Comparing Strings in Batch inside a for (if statement))
body: <p>I have a file1.txt with some file names. 
  I want to read from the file and if the file name contains "xyz" string i need to run some commands and if not some other commands
  Not able to do this and need your help,tried a lot of methods but not able to figure out
  Here's the sample code i tried:</p>
  
  <pre><code> @echo off
   setlocal EnableDelayedExpansion
  
   for /F "tokens=1,2,3 delims=" %%i in (file1.txt) do (
       set f=%%i
       set z=XYZ
       echo !f! &gt;&gt;test.txt
       if /i "!f!" == "!z!" (
           echo matched &gt;&gt; test.txt
       ) else ( 
           echo nomatch &gt;&gt; test.txt
       )
   )
  </code></pre>