Commonly Used Automatic Variables in Windows PowerShell 2

By Steve Seguis

Part of Windows PowerShell 2 For Dummies Cheat Sheet

PowerShell 2 helps you automate functions within Windows. Its automation functions include automatic variables, variables the system defines automatically that are given values based on the condition or context at that particular point in time. Some of PowerShell 2’s most common automatic variables are in the following table:

Variable Name Description
$_ Contains the current object in the pipeline object.
$Args Array of undeclared parameters or values passed to a function,
script, or script block.
$False Contains the value FALSE.
$Home Full path to the user’s home directory
$NULL Contains NULL or empty value.
$Profile Full path to the Windows PowerShell user profile for default
$Pwd Full path to the current directory.
$True Contains the value TRUE.