title: How can I set an Azure Devops pipeline variable via an inline PowerShell command?
body: <p>I have an Azure Devops build YAML file that contains the following task:</p>
  <pre class="lang-js prettyprint-override"><code>  - task: PowerShell@2
      displayName: 'Set coverage variable'
      inputs:
        targetType: 'inline'
        script: Write-Host &quot;##vso[task.setvariable variable=coverage]Get-Content .\coverage\lcov-report\summary.txt&quot;
  </code></pre>
  <p>I would like this task to set the variable <code>coverage</code> to be the value of the contents of <code>summary.txt</code>. However, when accessing the variable in the following task, I see that the variable is literally the string <code>Get-Content .\coverage\lcov-report\summary.txt</code>.</p>
  <p>There seems to be no example anywhere in the documentation as to how to pull this off. Is it just a limitation of scripting? Do I have to set the <code>Get-Content</code> command to a variable and then access that variable?</p>