PowerShellAutomatic Variables


Introduction

Automatic Variables are created and maintained by Windows PowerShell. One has the ability to call a variable just about any name in the book; The only exceptions to this are the variables that are already being managed by PowerShell. These variables, without a doubt, will be the most repetitious objects you use in PowerShell next to functions (like $? - indicates Success/ Failure status of the last operation)

Syntax

  • $$ - Contains the last token in the last line received by the session.
  • $^ - Contains the first token in the last line received by the session.
  • $? - Contains the execution status of the last operation.
  • $_ - Contains the current object in the pipeline