Automatic variables are just like regular PowerShell variables, except:
No. | Variable Name | Description & Example |
---|---|---|
$$ | The last token of the last line executed. PS C:\> get-date Saturday, June 3, 2017 10:27:25 PM PS: C:\> $$ get-date PS C:\> (get-process).count 152 PS: C:\> $$ count | |
$? | | |
$^ | ||
$_ | ||
$args | ||
$consolefilename | ||
$error | ||
$event | ||
$eventargs | ||
$eventsubscriber | ||
$executioncontext | ||
$false | ||
$foreach | ||
$host | ||
$home | ||
$input | ||
$lastexitcode | ||
$matches | ||
$myinvocation | ||
$nestedpromptlevel | ||
$null | ||
$ofs | ||
$pid | ||
$profile | ||
$psboundparameters | ||
$pscmdlet | ||
$pscommandpath | ||
$psculture | ||
$psdebugcontext | ||
$pshome | ||
$psitem | ||
$psscriptroot | ||
$psenderinfo | ||
$psuiculture | ||
$psversiontable | ||
$pwd | ||
Report Error Show Variables | ||
$sender | ||
$shellid | ||
$stacktrace | ||
$this | ||
$true |