Różnica między $? i $ LastExitCode w PowerShell

W PowerShell jaka jest różnica między$? i$LastExitCode?

czytamo zmiennych automatycznychi powiedział:

$? Contains the execution status of the last operation. It contains TRUE if the last operation succeeded and FALSE if it failed.

$LastExitCode Contains the exit code of the last Windows-based program that was run.

W definicji$? nie wyjaśnia, co oznacza sukces i porażka.

Pytam, bo tak przypuszczałem$? jest Prawdą, jeśli i tylko wtedy, gdy $ LastExitCode ma wartość 0, ale znalazłem zaskakujący kontrprzykład:$ LastExitCode = 0, ale $? = False w PowerShell. Przekierowanie stderr na stdout daje NativeCommandError.

questionAnswers(1)

yourAnswerToTheQuestion