Forum Discussion
Sandeepkv3003
Oct 18, 2021Copper Contributor
Powershell command to check output of last executed command
Just like in Linux, you can use $? to find the output of last command executed, is there any powershell command that I can use on the command line?
I tried $? but it returns True or False.
- JoeAtEastmanChemCopper Contributorget-lastoutput - JoeInTenn
- AndySvintsSteel Contributor
Hello Sandeepkv3003,
As far as I know, in Linux $? returns exit status of the most recently executed foreground pipeline. (Reference).
In PowerShell it does pretty much the same returns True or False depending on whether the last command (cmdlet or native) exited without error or not. (Reference)
Not sure what you are trying to accomplish and what your use case is but I suppose this could help you: https://stackoverflow.com/questions/43094708/powershell-exit-status
Hope that helps.