Getting the path of %AppData% in PowerShell

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:


or for local app data:


To get the AppData directory, use the GetFolderPath method:


Or as Andy mentions in his comment, simply:


$TempInstallerPath="$Env:USERPROFILE\AppData\Local\Downloaded Installations"
if(Test-Path $TempInstallerPath)
    Remove-Item "$TempInstallerPath\*" -Recurse -Force -ErrorAction 0

Need Your Help

How to get human-readable type of a complex expression at compilation time?

c++ gcc types

Suppose there's a complex expression EXPRESSION, and it's quite hard even for the IDE to find some of the methods called in it etc., so it's very hard to figure out the type it evaluates to. Curren...