title: How to Pass Variables from one Batch to Another
body: <p>I have a bat script and I am trying to capture processing time of each functionality within it. I have two other bat scripts that capture the start time and end time but when I try to pass back those variables to the main script, it does not work. Please advise</p>
  
  <blockquote>
    <p>TRIGGER.bat</p>
  </blockquote>
  
  <pre><code>if exist "inProcess.lok". (
     exit
        ) else (
              if EXIST "some.ZIP". (
                  call startTime.bat
                  set /a startDel=%1
  
      ::some Process
  
                  call endTime.bat
                  set /a endDel=%2
                  set /a timeDel= ( %endDel% - %startDel% )
                  set /a timeDels= %timeDel% / 100
                  set timeDel=%timeDels%.%timeDel:~-2%
                  echo %timeDel%
                  echo %timeDel%
                  echo %timeDel%
                  pause
      ))
  </code></pre>
  
  <blockquote>
    <p>startTime.BAT</p>
  </blockquote>
  
  <pre><code>set starttime=%TIME%
  set startcsec=%STARTTIME:~9,2%
  set startsecs=%STARTTIME:~6,2%
  set startmins=%STARTTIME:~3,2%
  set starthour=%STARTTIME:~0,2%
  set /a starttime=(%starthour%*60*60*100)+(%startmins%*60*100)+(%startsecs%*100)+(%startcsec%)
  
  :trigger.bat %starttime%
  </code></pre>
  
  <blockquote>
    <p>endTime.Bat</p>
  </blockquote>
  
  <pre><code>set endtime=%time%
  set endcsec=%endTIME:~9,2%
  set endsecs=%endTIME:~6,2%
  set endmins=%endTIME:~3,2%
  set endhour=%endTIME:~0,2%
  if %endhour% LSS %starthour% set /a endhour+=24
  set /a endtime=(%endhour%*60*60*100)+(%endmins%*60*100)+(%endsecs%*100)+(%endcsec%)
  
  :trigger.bat %endtime%
  </code></pre>