'How do I read a .env file from a .ps1 script?
I have a .env
file like this one:
TESTCASE_GROUP_SIZE=25
. . .
And I want to get its value (read it) into a .ps1
script.
How can I do it?
Solution 1:[1]
get-content test.env | foreach {
$name, $value = $_.split('=')
set-content env:\$name $value
}
assuming you mean "set one environment variable per line in the file".
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TessellatingHeckler |