Equivalent of "cd %programfiles%" in PowerShell?

The principle is:

$Env:variablename

So you might try:

cd $Env:Programfiles

or to temporarily switch working directory to %Programfiles%\MyApp:

Push-Location -Path "$Env:Programfiles\MyApp"
#
# command execution here
#
Pop-Location

To list all environment variables you could do:

Get-ChildItem Env:

or use the convenient alias:

ls env:

To see all the environment variables, do this:

dir env:

To see all the ones containing "Program", do this:

dir env: | ? { $_.Value -match 'Program' }

In PowerShell 3 it is cleaner:

dir env: | ? Value -match 'Program'

The one we want is env:ProgramFiles, and we can just do this:

cd $env:ProgramFiles