Env Variables using Powershell

June 13, 2022

View all env variables:

Get-ChildItem -Path Env:

Set env variable:

$ENV:INSTANCE="prod"

Script to read .env file and load env variables:

get-content .env | foreach {
    $name, $value = $_.split('=')
    set-content env:\$name $value
}
  • run with script.ps1