set environment variable powershell code example
Example 1: powershell set environment variable
PS C:\> $env:VAR_NAME="VALUE"
Example 2: powershell print environment variables
$Env:path
Get-ChildItem env
Example 3: how to get environment variables in powershell
cd Env:
Get-ChildItem
Example 4: set variable in powershell
Set-Variable -Name "desc" -Value "A description"
Get-Variable -Name "desc"
Name Value
---- -----
desc A description
Example 5: powershell environment variables set
$Env:<variable-name> = "<new-value>"