title: batch file with echo findstr not working inside for loop
body: <p>I have multiple string that come from a reg query inside a for loop.
  I want to validate for each of them if it has certain words and do actions if it has.
  My code is this:</p>
  
  <pre><code>for /l %%g in (0 1 3) do (
          echo HOME%%g
          for /f "tokens=1,2,3*" %%h in ('reg query \\%%c\HKLM\SOFTWARE\ORACLE\HOME%%g /v ORACLE_HOME') do (
  
              echo HOME%%g
              echo %%j
              echo %%j | findstr /I /R /C:"806"
              if %ERRORLEVEL% equ 0 (
                  echo YES
              ) else (
                  echo NO
              )
  
              echo %%j | findstr /C:".isuites."
              if %ERRORLEVEL% equ 0 (
                  echo YES
              ) else (
                  echo NO
              )
  
              echo %%j | findstr /I ora90
              if errorlevel 0 (
                  echo YES
              ) else (
                  echo NO
              )
  
              echo %%j | findstr /I forms10
              if errorlevel 0 (
                  echo YES
              ) else (
                  echo NO
              )
  
  
  
          )
      )
  </code></pre>
  
  <p>The problem is that is does not validates the string as seen in the output</p>
  
  <pre><code>HOME0
  HOME0
  ECHO is off.
  YES
  YES
  YES
  YES
  HOME0
  d:\oracle\806
  d:\oracle\806
  YES
  YES
  YES
  YES
  HOME1
  HOME1
  ECHO is off. 
  YES
  YES
  YES
  YES
  HOME1
  d:\oracle\iSuites
  YES
  YES
  YES
  YES
  HOME2
  HOME2
  ECHO is off.
  YES
  YES
  YES
  YES
  HOME2
  d:\oracle\ora90
  YES
  YES
  d:\oracle\ora90
  YES
  YES
  HOME3
  HOME3
  ECHO is off.
  YES
  YES
  YES
  YES
  HOME3
  D:\oracle\forms10g
  YES
  YES
  YES
  D:\oracle\forms10g
  YES
  </code></pre>