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:
- pipe output of
cmdvariable doesn't write host - only if
$succeededeq $true,write-hostoutput variablecmd
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
Post a Comment