title: Finding File Matches & Variable Assignment using a .BAT Script
body: <p>I am trying to assign a file to a variable in a <a href="/questions/tagged/batch-file" class="post-tag" title="show questions tagged &#39;batch-file&#39;" rel="tag">batch-file</a> and then also assign another 2 files into anoter variable.</p>
  
  <p>However, I am having an issue.</p>
  
  <p>From research, I found how I can do the assigning but does anyone know how I can do the below.</p>
  
  <p>From a folder or text file, (either is fine), find the <code>.m2v</code> video file and assign that to <code>Var1</code> then find matching audio in <code>.wav</code> and put that in <code>Var2</code> and the third is also an audio <code>.wav</code> with mathcing name and assign that to <code>Var3</code>.</p>
  
  <p>The problem I am having is trying to find the matching <code>2</code> audio files to the video.</p>
  
  <p>The video file is named as:</p>
  
  <pre><code>PAV_PRG_13683Highc450277201906251802090353.m2v
  </code></pre>
  
  <p>Audio 1 is:</p>
  
  <pre><code>PAV_PRG_13683High01c450211201906251802090376.wav
  </code></pre>
  
  <p>Audio 2 is:</p>
  
  <pre><code>PAV_PRG_13683High00c450211201906251802090368.wav
  </code></pre>
  
  <p>The file name matches until it sees the word <code>High</code>. Everything after <code>High</code> is not needed, (it is just a random string), so trying to match is an issue.</p>
  
  <p>Is there a way to find the match by comparing everything before <code>High</code>.</p>
  
  <p>Also as I will be using the variable and putting them through <a href="/questions/tagged/ffmpeg" class="post-tag" title="show questions tagged &#39;ffmpeg&#39;" rel="tag">ffmpeg</a> to merge, is there way to do it so that when the <code>ffmpeg</code> command has completed, it moves to the next matching files and assigns them to the variable.</p>
  
  <p>The files are store in <code>2</code> folders, one folder has all the video files <code>*.m2v</code> and another folder has all the <code>*.wav</code> audio files in pairs of <code>2</code>. Each video has exactly <code>2</code> audios, (left right).</p>
  
  <p>is there any help on this subject, I have already come up empty in my research and have been checking for this over the last week spent almost 30 hours.</p>