title: Batch file, string variable comparison, if statement
body: <p>I am trying to compare the logs of a file with a plain string, but it is not getting into if comparison. I am getting " Connect failed" as my 2nd token in echo statement, but not getting any result of IF statement.</p>
  
  <pre><code>@echo off
  rem start cmd.exe
  for /f "tokens=2 delims=:" %%n IN (C:\Users\rohit.bagjani\Desktop\result\telnetresult.txt) DO (
      SET str1 = " Connect failed"
      echo %%n
      if \i %str1%==%%n echo "true"
  )
  echo.
  pause
  </code></pre>