$serverdir = "M:\project\minecraft-server-anywhere\survival" $servername = "survival" # Load Environment Variables of Server get-content $serverdir\$servername.env | ForEach-Object { if (!$_.StartsWith("#") -and !($_.Length -eq 0)) { # Skips Empty and Commented Lines $name, $value = $_.split('=') Set-Variable "server.$name" "$value" } } Get-Variable *