Suppose I cd to an empty directory in powershell and run the following command:
get-childitem x
The command will throw an error that it cannot find the path, which is expected.
However, when I check the $LastExitCode it is still zero.
This is confusing to me, since according to the docs $LastExitCode should contain the exit code of the last windows-based program that was run.
Could anyone please explain why the exit code is still zero after I run a command which clearly fails?