PowerShell - Exit Code
PowerShell - Exit Code $arg1Data = "someArgText"; $Proc = Start-Process -FilePath "some.exe" -ArgumentList @("-arg1:$arg1Data",'-someOtherSwitch','-anotherArg:someOtherText',"someStaticTextThatIsAnArg") -PassThru -Wait -NoNewWindow; if($Proc.ExitCode -ne 0) { Throw "Failed to execute with exitcode: $($Proc.ExitCode)"; } With Splatting $exe = "some.exe"; $arg1Data = "someOtherArgContent"; $cmdArgs = @( "-arg1:$arg1Data" ,'-someOtherSwitch' ,'-anotherArg:someOtherText' ,"someStaticTextThatIsAnArg" ); $parms = @{ "FilePath"=$exe; "ArgumentList"=$cmdArgs; "PassThru"=$true; "Wait"=$true; "NoNewWindow"=$true; } $Proc = Start-Process @parms; if($Proc.ExitCode -ne 0) { Throw "Failed to execute with exitcode: $($Proc.ExitCode)"; } https://docs. [Read more...]