Variables

View saved

Assign and read

Names start with $.

$name = "Ada"
$year = 2026
Write-Output "$name is learning PowerShell in $year"

Store command output

Capture objects for later filtering or export.

$procs = Get-Process
$procs | Sort-Object WorkingSet64 -Descending | Select-Object -First 3

Arrays and hashtables

Common beginner collections.

$colors = @("red", "green", "blue")
$person = @{ Name = "Sam"; Role = "learner" }
$person.Name

Environment variables

Read and set process environment values carefully.

$env:USERNAME
$env:PATH

Comments

One comment per signed-in account. Comments are saved with this page’s URL.