PowerShell Automatic Variables

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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


Got any PowerShell Question?