title: Return a String from a Windows Batch file
body: <p>I want to find the target branch when a pull request is submitted on GitHub, in my Jenkins pipeline. To achieve this I am doing the following:</p>
  
  <p>I am invoking a windows batch file from my Jenkinsfile, which in turn invokes a nodejs script. This script internally invokes GitHub APIs to get the target branch which is to be set on some variable in Jenkinsfile(code snippet given below):
  Jenkinsfile</p>
  
  <pre><code>env.TARGET_BRANCH = bat "GetTargetBranchFromGit.bat ${env.BRANCH_NAME}"
  </code></pre>
  
  <p>BatchFile:</p>
  
  <pre><code>node getTargetBranchForPR.js %1
  </code></pre>
  
  <p>But unfortunately, the variable env.TARGET_BRANCH is not getting set to the target branch even though the nodejs script gets the right value. I am in fact not able to return the value from the batch file. Could someone please help me here?</p>