Renaming a Html File based upon content from within the file by using a Batch File
<p>I need a batch file that reads a line of text within an html file and then will rename that file name based on what it finds.</p>

<p>I have a large number of html files where their file names are just numbers.html (2345.html)for example.</p>

<p>Within each of the html files is a line that roughly looks like the following; example 1 - <code>&lt;span class="term-name"&gt;fed up&lt;/span&gt;&amp;nbsp;&amp;nbsp;</code>  </p>

<p>example 2 - <code>&lt;span class="term-name"&gt;ventilating&lt;/span&gt;&amp;nbsp;&amp;nbsp;</code></p>

<p>How can I possibly get the batch file to find the line containing <code>&lt;span class="term-name"&gt;</code> and then rename the file to the words that is after and before <code>&lt;/span&gt;&amp;nbsp;&amp;nbsp;</code>.</p>

<p>In my above example it would make a file called ventilating.txt and another file called fed up.txt</p>

<p>I have an example of where it can find a line in the file like Description=Mike and then produces a file called Mike.txt. (see the .bat below)</p>

<p>But I cannot work out how to select the words from my above examples. </p>

<pre><code>    @echo off

for %%i in (%1) do (
  for /f "tokens=2 delims==" %%j in ('findstr /B /I "Description=" "%%i"') do (
    ren "%%i" "%%j.temp_txt"
  )
)

ren *.temp_txt *.txt
</code></pre>