title: How to return value from one batch file to caller batch file
body: <p>I have a common .bat file that reads the status.xml file and finds out the value of the status field. This batch file is then called by other batch files for finding out status value. the calling batch files send the file name to the common bat file.
  I am not able to send the status from the common batch file to the calling batch files.
  Can someone please help?</p>
  
  <pre><code>main batch file
  -- will call the common bat file and send the file name and a variable as arguments
  setlocal
  call Common.bat c:\folderdir\files\status.xml val1
  -- trying to print the status returned by the common bat file
  echo [%val1%]
  
  common batch file
  @ECHO off
  setlocal EnableDelayedExpansion
  
  rem will loop through the file and read the value of the status tag
  (for /F "delims=" %%a in (%1) do (
  set "line=%%a"
  set "newLine=!line:&lt;Interface_status&gt;=!"
  set "newLine=!newLine:&lt;/Interface_status&gt;=!"
  if "!newLine!" neq "!line!" (
    @echo Status is !newLine!
  rem I want to send`enter code here` the value of newLine to the calling batch file
    set %~2 = !newLine!   &lt;--this does not work
  )
  
  )) 
  </code></pre>