title: Get string from file in batch
body: <p>Task in CMD. </p>
  
  <p>1) How can I compare if string is in string? I checked manual <a href="http://ss64.com/nt/syntax-replace.html" rel="nofollow">here</a> for "Boolean Test "does string exist ?"" But I can't understand the example or it does not work for me. This piece of code, it is just a try. I try to make a string compare of filter some sting if there is a tag <code>&lt;a&gt;</code> in a line.</p>
  
  <pre><code>FOR /f "tokens=* delims= usebackq" %%c in ("%source%") DO ( 
  echo %%c
  IF %%c == "&lt;a" (pause) 
  )
  </code></pre>
  
  <p>So while I read a file, it should be paused if there is a link on a line. </p>
  
  <p>2) I have one more ask. I would need to filter the line if there is a specific file in the link, and get content of the link. My original idea was to try to use <code>findstr</code> with regex, but it seems not to use sub-patterns. And next problem would be how to get the result to variable.</p>
  
  <pre><code>set "pdf=0_1_en.pdf"
  type "%source%" | grep "%pdf%" | findstr /r /c:"%pdf%.*&gt;(.*).*&lt;/a&gt;"
  </code></pre>
  
  <p>So in summary, I want to go through file and if there is a link like this: <strong>REPAIRED:</strong> *</p>
  
  <pre><code>&lt;a href="/Dokumenter/dsweb/Get/Document-408/EK_GEN_0_1_en.pdf" class="uline"&gt;&lt;b&gt;GEN 0.1 Preface&lt;/b&gt;&lt;/a&gt;
  </code></pre>
  
  <ul>
  <li>I forgot to style this as a code, so the inside of code was not displayed. Sorry.</li>
  <li>Warnning: we don't know the path, only the basic filename.</li>
  </ul>
  
  <p>Get the title GEN 0.1 Preface. But you should know, that there are also similar links with same link, which contain image, not a text inside a tag.</p>
  
  <p>Code according Aacini to be changed a little bit:</p>
  
  <pre><code>@echo off
  setlocal EnableDelayedExpansion
  set "source=GEN 0 GENERAL.html"
  set "pdf=0_1_en.pdf"
  echo In file:%source%
  echo Look for anchor:%pdf%
  
  rem Process each line in %source% file:
  for /F "usebackq delims=" %%c in ("%source%") do (
     set "line=%%c"
     rem Test if the line contain a "tag" that start with "&lt;a" string:
     set "tag=!line:*&lt;a=!"
     if not "!tag!" == "!line!" (
        rem Take the string in tag that end in "&gt;"
        for /F "delims=^&gt;" %%a in ("!tag!") do set "link=%%a"
        echo Link found: !link!
        if "!link!" == "GEN 0.1 Preface" echo Seeked link found
     )
  )
  pause
  </code></pre>
  
  <p>Still not finished</p>