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

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -