how to set system environment variable in powershell code example Example: powershell set environment variable # Windows PowerShell PS C:\> $env:VAR_NAME="VALUE"