Piping cmd output to variable in PowerShell -


i have following in powershell script:

cmd /c npm run build-release  $succeeded = $lastexitcode 

what i'd is:

  1. pipe output of cmd variable doesn't write host
  2. only if $succeeded eq $true, write-host output variable cmd

how can done?

use invoke-expression:

$output = invoke-expression "cmd /c npm run build-release" $succeeded = $lastexitcode  if($succeeded -eq 0) {   write-output $output } 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -