title: How to do substring with variable length in a for loop inside batch files?
body: <p>I am trying to do some string comparison and extraction in a batch file. The operation takes place on a set of folder names from a SVN repository. </p>
  
  <pre><code>for /f %%f in ('svn list https://dev_server/svn/product/branches') do ( 
      set folder=%%f 
  
      echo Folder: %folder%
  
      :: get substring from %folder% starting at 0 with a length of %length%
      :: if this substring is equal to %folderStart% then get substring from %folder% starting at position %length%   
  )
  </code></pre>
  
  <p>There are a couple of problems here: </p>
  
  <ol>
  <li>The value of %%f is not assigned to %folder% for some reason. </li>
  <li>Even though I have searched the web extensively, I didn't find a solution to doing substring with variable length. The batch file substring function :~ only seems to take fixed integer values. </li>
  </ol>
  
  <p>Does anyone have an idea how I could implement the functions in the commented section in the code above?</p>