title: How do I return a value from a function in a batch file?
body: <p>I have the following batch file</p>
  
  <pre><code>@echo off
  setlocal EnableDelayedExpansion
  for /f "delims==" %%J in (File_List.txt) do (
  call :setDate %%J MYD
  echo/Date is: %MYD%
  )
  endlocal &amp;goto :eof
  
  :setDate
  SETLOCAL ENABLEEXTENSIONS
  echo %1
  echo %~2
  set NAME=%1
  set NAME=%NAME:~-11%
  echo %NAME%
  echo %~2
  endlocal&amp;set %2=%NAME%&amp;goto :eof
  </code></pre>
  
  <p>but with File_List.txt containing 
      file2012-05.csv</p>
  
  <p>I get </p>
  
  <pre><code>file2012-05.csv
  MYD
  2012-05.csv
  MYD
  Date is:
  </code></pre>
  
  <p>How do I actually get the function setDate to return the value I want?</p>