相关疑难解决方法(0)

$?之间的区别?和PowerShell中的$ LastExitCode

在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中的$?= False.将stderr重定向到stdout会产生NativeCommandError.

windows powershell command-line

55
推荐指数
1
解决办法
6万
查看次数

标签 统计

command-line ×1

powershell ×1

windows ×1