Set-PsEnv icon indicating copy to clipboard operation
Set-PsEnv copied to clipboard

PowerShell DotEnv Loader

Set-PsEnv

PowerShell DotEnv

This is a simple script to load the .env file to process environment from the current directory.

Usage

Add the function Set-PsEnv to the prompt function.

Set-PsEnv
# This is function is called by convention in PowerShell
function prompt {
    Set-PsEnv
}

Create a .env file at the folder level the environment variable has to be exported
Sample .env file

#This is a comment
#Prefix to a variable
PATH := c:\test
#Append to a variable
PATH =: c:\suffix\bin
#Assign a variable
PYTHON=c:\python

Installation

From PowerShell Gallery

Install-Module -Name Set-PsEnv