Skip to content

Instantly share code, notes, and snippets.

@GoaLitiuM
Created September 11, 2018 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GoaLitiuM/64e0ae7f0879258fbd86315738ab92f9 to your computer and use it in GitHub Desktop.
Save GoaLitiuM/64e0ae7f0879258fbd86315738ab92f9 to your computer and use it in GitHub Desktop.
DMD install script for Windows
Set-StrictMode -Version latest
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
# default installation directory
$dmd_install = "C:\D"
echo "Fetching latest DMD version..."
$dmd_version = [System.Text.Encoding]::ASCII.GetString((Invoke-WebRequest -URI "http://downloads.dlang.org/releases/LATEST").content)
$dmd_url = "http://downloads.dlang.org/releases/2.x/$dmd_version/dmd.$dmd_version.windows.zip"
$dmd_filename = [System.IO.Path]::GetFileName($dmd_url)
$dmd_archive = Join-Path (pwd).path $dmd_filename
echo "Downloading $dmd_filename..."
$client = new-object System.Net.WebClient
$client.DownloadFile($dmd_url, $dmd_archive)
echo "Extracting $dmd_filename..."
Expand-Archive $dmd_archive -Force -DestinationPath $dmd_install
# add to environment path
echo "Installing DMD..."
$dmd_bin = Join-Path $dmd_install "dmd2\windows\bin"
$Env:Path = $Env:Path + ";" + $dmd_bin
echo "Testing DMD..."
& dmd.exe --version 2>&1>$null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment