在PowerShell中,之间有什么区别$?
和$LastExitCode
?
我读了有关自动变量 ,它说:
$? 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.
在定义$?
这并不能说明什么成功和失败的意思。
我问,因为我假定$?
是真当且仅当$ LastExitCode是0,但我发现一个令人惊讶的反例: $ LastExitCode = 0,但$ =在PowerShell中假? 重定向错误输出到标准输出给NativeCommandError 。