What is the meaning of $? in Powershell?
$?
Edit: TechNet answers in tautology, without explaining what \'succeed\' or \'fail\' mean.
You can also access last commands exit code using $LastExitCode parameter.
$LastExitCode
# run some command # ... if ((! $?) -and $ErrorAction -eq "Stop") { exit $LastExitCode }