Skip to content

Latest commit

 

History

History

ps1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

PowerShell Dotenv

A dotenv package does not exist for PowerShell. So we are going to manually read the .env file and set all the environment variables.

For a .env file like this:

get-content .env | foreach {
    if ($_ -like '*=*') {
        $name, $value = $_.split('=')
        set-content env:\$name $value
    }
}

Write-Host $env:DB_NAME