title: Windows Batch File: Looping through Network Shares
body: <p>I have a classroom network where all of the machines have a shared folder following the same pattern. Each share can be accessed as:</p>
  
  <p><code>\\…\foo\bar\folder</code></p>
  
  <p>Here, the names <code>foo</code>, <code>bar</code> and <code>folder</code> are fixed, and only the computer name is different.</p>
  
  <p>Eventually I plan to copy files to all of the folders above.</p>
  
  <p>The question is: how do I loop through all of the share names above? In a command shell, I tried:</p>
  
  <p><code>for %i in (\\*\foo\bar\folder) do echo %i</code></p>
  
  <p>but that’s not working for me.</p>
  
  <p>Thanks</p>