title: Batch script to replace specific string in multiple files
body: <p>I don't have much experience with batch scripts, and my employer has asked me write a batch script that can be run to find and replace some text inside all matching files in the directory.</p>
  
  <p>I've tried searching this and there's a tonne of resource, which I've used to get me this far:</p>
  
  <pre><code>@echo off 
      setlocal enableextensions disabledelayedexpansion
  
      set "search=&lt;employeeloginid&gt;0"
      set "replace=&lt;employeeloginid&gt;"
  
      set "textFile=TimeTEQ20170103T085714L.XML"
  
      for /f "delims=" %%i in ('type "%textFile%" ^&amp; break ^&gt; "%textFile%" ') do (
          set "line=%%i"
          setlocal enabledelayedexpansion
          set "line=!line:%search%=%replace%!"
          &gt;&gt;"%textFile%" echo(!line!
          endlocal
      )
  </code></pre>
  
  <p>This will find all occurrences of <code>&lt;employeeloginid&gt;0</code> and replace it with <code>&lt;employeeloginid&gt;</code> inside a <strong>set file</strong> - in this case <code>TimeTEQ20170103T085714L.XML</code>.</p>
  
  <p>I now need to tweak this to run on all files that <strong>start with</strong> <code>TimeTEQ</code> and <strong>end with</strong> <code>.xml</code></p>
  
  <p>I found <a href="https://stackoverflow.com/a/4663992/1739852">this answer</a> which shows how to do all files in a directory, but I don't know how I would tweak it to suit my needs here.</p>
  
  <p>Can anyone help me please?</p>