# Automatic Variable

*noun*

say it: **“aw-tuh-MAT-ik VAIR-ee-uh-bul”** **/ˌɔtəˈmætɪk ˈvɛəriəbəl/**

A variable that PowerShell creates and fills in by itself, such as the path of your home folder.

## What is an **automatic variable** in PowerShell?

An **automatic variable** is one PowerShell fills in and keeps up to date by itself: `$HOME` is your home folder, `$PSVersionTable` the version, `$?` whether the last command worked, and `$LASTEXITCODE` the last program's exit code. Read them any time; never give your own variables their names.

```powershell
Get-ChildItem edited\2026\06-june
$?        # False: the last command didn't work
```

## In a sentence

- “Right after the copy failed, the **automatic variable** $? said False.”
- “$HOME is an **automatic variable**, so Sam never has to set it.”

Level: Apprentice · [More PowerShell terms at this level](https://www.ask-codey.com/glossary?category=powershell&level=2)

Updated: November 10, 2026

Source: https://www.ask-codey.com/glossary/automatic-variable
