title: How to find and replace part of filenames from list
body: <p>I have a list of files that I need to rename at the same part of each file, with different values.</p>
  
  <p>Example:</p>
  
  <pre><code>BL_1402B103_abc.wav &gt; BL_C1234-1_abc.wav
  
  BL_15489B59_abc.wav &gt; BL_C1234-5_abc.wav
  </code></pre>
  
  <p>So in the first example above I want to replace the <code>1402B103</code> with <code>C1234-1</code> all the files are the same length and the sections I want to replace are separated by "<code>_</code>". </p>
  
  <p>I have some code for finding/replacing parts of a filename but I need to do this for hundreds of files - is there a way to pull Pattern= &amp; Replace= as variables from a csv/list and run as a batch?</p>
  
  <pre><code>Setlocal enabledelayedexpansion
  
  Set "Pattern=1402B103"
  Set "Replace=C1234-1"
  
  For %%f in (*.wav) Do (
      Set "File=%%~f"
      Ren "%%f" "!File:%Pattern%=%Replace%!"
  )
  </code></pre>