How can I get the path for the application data directory (e.g. C:\Users\User\AppData\Roaming
) in PowerShell?
This is the shortest way:
$env:APPDATA
or for local app data:
$env:LOCALAPPDATA
To get the AppData directory, use the GetFolderPath
method:
[Environment]::GetFolderPath([Environment+SpecialFolder]::ApplicationData)
Or as Andy mentions in his comment, simply:
[Environment]::GetFolderPath('ApplicationData')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With