title: Jenkins Declarative Pipeline: How to use arguments passed into function in Windows bat command?
body: <p>I have a pipeline in which I am defining a function that takes string arguments and then attempting to use that function/parameters in a step that contains a bat command. I cannot for the life of me figure out how to get those string parameters exposed in the bat command. </p>
  
  <p>Here is the function-</p>
  
  <pre><code>// publish step
  def publish(String projectName, String publishProfile) {
      echo "${projectName}"
      echo "${publishProfile}"
      bat ''' sqlpackage.exe /Action:Publish /SourceFile:%WORKSPACE%\\%projectName%\\bin\\Debug\\%projectName%.dacpac /Profile:%WORKSPACE%\\%projectName%\\Publish\\%publishProfile% '''
  }
  </code></pre>
  
  <p>In the console output, I can see the correct projectName and publishProfile that were passed in being echoed. %WORKSPACE% is exposed correctly in the bat command. However, %projectName% and %publishProfile% are just blank. I've tried a lot of combinations of double quotes, single quotes, etc. How do I get these exposed in the bat command?</p>