You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'HELLO = WORLD'> .env
# Accepts a single fileNew-Environment .env
# Or multiple files$dotenvFiles=Get-ChildItem-Filter *.env -Path .
New-Environment-Force $dotenvFiles# Pipelining worksGet-ChildItem-Filter *.env -Path .|New-Environment# Read environment from a hash table insteadNew-Environment-Force -Environment @{'HELLO'='WORLD'}
# Hash table definitions always override dotenv files$overrides=@{'HELLO'='OVERRIDE'}
New-Environment-Force -EnvironmentFile .env -Environment $overrides$env:HELLO-eq'OVERRIDE'
Invoke-Environment
# Environment is only available in the script block'HELLO = WORLD'> .env
Invoke-Environment .env { $env:HELLO-eq'WORLD' }
$env:HELLO-eq$null# Again, hash table definitions always override dotenv files$overrides=@{'HELLO'='OVERRIDE'}
Invoke-Environment-EnvironmentFile .env -Environment $overrides {
$env:HELLO-eq'OVERRIDE'
}
Get-Environment and Remove-Environment
'HELLO = WORLD'> .env
# Setup a new enviromentNew-Environment .env
$env:HELLO-eq'WORLD'# Do some work with this environment set# ...# To check which variable are set/overridden in the current environmentGet-Environment# To stop using the current environmentRemove-Environment$env:HELLO-eq$null