Created
January 9, 2014 21:24
-
-
Save chgeuer/8342314 to your computer and use it in GitHub Desktop.
Install Erlang via command line
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
# | |
# Check if Erlang is installed | |
# | |
$erlangkey = Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Ericsson\Erlang -ErrorAction SilentlyContinue | |
if ( $erlangkey -eq $null ) { | |
Write-Host "Erlang not found, need to install it" | |
Start-Process -Wait otp_win64_R16B03.exe /S | |
} | |
# | |
# Determine Erlang home path | |
# | |
$ERLANG_HOME = ((Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Ericsson\Erlang)[0] | Get-ItemProperty).'(default)' | |
[System.Environment]::SetEnvironmentVariable("ERLANG_HOME", $ERLANG_HOME, "Machine") | |
# | |
# Add Erlang to the path if needed | |
# | |
$system_path_elems = [System.Environment]::GetEnvironmentVariable("PATH", "Machine").Split(";") | |
if (!$system_path_elems.Contains("%ERLANG_HOME%\bin") -and !$system_path_elems.Contains("$ERLANG_HOME\bin")) | |
{ | |
Write-Host "Adding erlang to path" | |
$newpath = [System.String]::Join(";", $system_path_elems + "$ERLANG_HOME\bin") | |
[System.Environment]::SetEnvironmentVariable("PATH", $newpath, "Machine") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment