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:ProgramfilesMyApp"
#
# command execution here
#
Pop-Location
To list all environment variables you could do:
Get-ChildItem Env:
or use the convenient alias:
ls env:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…