Appendix C. PowerShell Automatic Variables
PowerShell defines and populates several variables automatically. These variables let you access information about the execution environment, PowerShell preferences, and more.
Table C-1 provides a listing of these automatic variables and their meanings.
Variable | Meaning |
| Last token of the last line received by the shell. |
| Success/fail status of the last operation. |
| First token of the last line received by the shell. |
| Current pipeline object in a pipelined script block. |
| Array of parameters passed to the script, function, or script block. |
| Preference that controls the level of impact that operations may have before requesting confirmation. Supports the values |
| Filename of the PowerShell console file that configured this session, if one was used. |
| Currently executing command, when in a suspended prompt. |
| Preference that controls how PowerShell should handle debug output written by a script or cmdlet. Supports the values |
| Array that holds the (terminating and nonterminating) errors generated in the shell. |
| Preference that controls how PowerShell should handle error output written by a script or cmdlet. Supports the values |
Get Windows PowerShell Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.