Last active
May 20, 2021 13:50
-
-
Save sevenc-nanashi/5a4b44161f3f7b6ce991a177188ff7a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param($file = ".env") | |
$DB = Get-Content $file | |
$Count = 0 | |
foreach ($Data in $DB) { | |
$Count += 1 | |
Invoke-Expression ([regex]::Replace($Data,"^([^=]+)=""?([^=]+)""?$",{"`$env:" + $args.groups[1].value + "=""" + $args.groups[2].value + """"},[System.Text.RegularExpressions.RegexOptions]::Multiline)) | |
} | |
write-host "Loaded " -NoNewline | |
write-host $Count -NoNewline -ForegroundColor Cyan | |
write-host " Variables." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment