title: Concatenate file paths to an environment variable in batch script
body: <p>I have made a bat script that should copy the list of folders to a variable but I don't get anything in the variable. In other words, when I echo the variable after my for loop I get the expected output, but in the shell outside after executing the script, I don't see anything set in my variable. How can I get all the variables to copy correctly?</p>
  
  <p>I am using Windows 7.</p>
  
  <p>Batch FIle (script.bat):</p>
  
  <pre><code>@echo off
  setlocal enabledelayedexpansion enableextensions
  
  for /r /D %%x in (*) do (
      SET PATH_VALUE=%%x;!PATH_VALUE!
  )    
  echo %PATH_VALUE%
  </code></pre>
  
  <p>Output of windows cmd utility</p>
  
  <pre><code>C:\test&gt; script.bat
  C:\test\1;C:\test\2
  
  C:\test&gt; echo %PATH_VALUE%
  %PATH_VALUE%
  </code></pre>
  
  <p>How do I get the %PATH_VALUE% as an environment variable? I found a similar question <a href="https://stackoverflow.com/questions/10248994/concatenate-file-paths-to-variable-in-batch-script">here</a> but it doesn't quite answer my case.</p>