title: How to pass environmental variables to downstream from jenkinsfile
body: <p>I am running Jenkins on a windows machine.
  How can I pass environment variables like %BUILD_NUMBER% to a downstream job?
  I am using below piece of code but that is not working as expected, it is printing the same thing again in output</p>
  
  <pre><code>build job: 'DeployBuild', parameters: [string(name: 'BuildId', value: $env:BUILD_NUMBER)], wait: false
  </code></pre>
  
  <p>The output I am getting: </p>
  
  <pre><code>C:\JenkinsBuilds\jobs\DeployBuild\workspace&gt;echo $env:BRANCH_NAME-$env:BUILD_NUMBER 
  $env:BRANCH_NAME-$env:BUILD_NUMBER
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] }
  [Pipeline] // node
  [Pipeline] End of Pipeline
  Finished: SUCCESS
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>C:\JenkinsBuilds\jobs\DeployBuild\workspace&gt;echo TESTJob-12
  TESTJob-12
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] }
  [Pipeline] // node
  [Pipeline] End of Pipeline
  Finished: SUCCESS
  </code></pre>
  
  <p>Tried multiple patterns like ${BUILD_NUMBER}, $BUILD_NUMBER %BUILD_NUMBER but none is giving the expected output.</p>