Skip to content

Commit

Permalink
Add PowerShell automatic variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielweyer committed Feb 11, 2023
1 parent 93798ec commit 9dd9794
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/powershell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ if ($LASTEXITCODE -ne 0) {

Based on an answer to the `Stack Overflow` question [PowerShell: Capture the output from external process that writes to stderr in a variable][powershell-capture-stderr].

## Most useful automatic variables

`$PSScriptRoot` contains the full path of the executing script's parent directory.

`$LASTEXITCODE` contains the exit code of the last native program or PowerShell script that was run. I use it only for native programs.

## References

- [The PowerShell Best Practices and Style Guide][powershell-style-guide]
Expand Down

0 comments on commit 9dd9794

Please sign in to comment.