Getting the path of %AppData% in PowerShell

powershell, scripting

Solution

This is the shortest way:

$env:APPDATA

or for local app data:

$env:LOCALAPPDATA

Problem

How can I get the path for the application data directory (e.g. `C:\Users\User\AppData\Roaming`) in PowerShell?

Original source