title: jenkins pipeline - both of groovy and powershell variables in powershell command
body: <p>I trying to define powershell variable inside jenkins pipeline with the WORKSPACE variable in value. Is there a way to do this?</p>
  
  <pre><code>stage ('BUILD') {
          steps {
              powershell ("""Write-Output ${WORKSPACE}\\One\\Two\\""")
              }
      }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>    [Pipeline] powershell
      18:18:15  C:\buildenv\Jenkins\workspace\project\One\Two\
      [Pipeline] }
      [Pipeline] // stage
  </code></pre>
  
  <p>That's nice. Now i need to wrap it into variable:</p>
  
  <pre><code>stage ('BUILD') {
          steps {
              powershell ("""$name02=${WORKSPACE}\\One\\Two\\""")
              }
      }
  </code></pre>
  
  <p>Output now:</p>
  
  <pre><code>groovy.lang.MissingPropertyException: No such property: name02 for class: groovy.lang.Binding
  at groovy.lang.Binding.getVariable(Binding.java:63)
  at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:264)
  at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
  at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
  at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
  at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
  at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
  at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
  at WorkflowScript.run(WorkflowScript:50)
  at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.delegateAndExecute(jar:file:/C:/buildenv/Jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:134)
  at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.executeSingleStage(jar:file:/C:/buildenv/Jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:679)
  at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(jar:file:/C:/buildenv/Jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:414)
  at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(jar:file:/C:/buildenv/Jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:412)
  at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.executeSingleStage(jar:file:/C:/buildenv/Jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:678)
  </code></pre>