Downloading Latest D Language DMD compiler via Windows 10 batch script file.

BoQsc vaidas.boqsc at
Tue Dec 17 16:55:56 UTC 2019

Initialy I though about a way to download DMD compiler on a 
single line of command prompt.
However it turned out that dlang website makes downloading the 
latest version a complex thing.

Here, I'm sharing a batch script that might be interesting if you 
are wondering how to download and launch latest d language 
compiler setup in a single click.

Usage: Copy and paste the script below into a text file
and rename the text file to a file name that ends in .cmd or .bat 


.cmd and .bat extensions are the same thing, no worries about 

>:: Downloads LATEST file from dlang, via bitsadmin - official 
>command line download utility included since Windows 7
>:: LATEST file is a plain text file that contains a single line 
>of text: a number of latest version of DMD. bitsadmin /Transfer 
>"%random%" "" 
>	TITLE BITSADMIN have an error, retrying to download LATEST file
>	GOTO :Download-version-number-file-from-dlang )
>:: A hacky Batch language way to store File content inside a 
>SET /P "version=" < "LATEST"
>:: Simply delete LATEST file, we don't need it anymore LATEST 
>file is stored inside variable named "version"
>:: Get YEARS from from Windows 10 Date Environment Variable
>:: Windows 7 might require adjustments to gather the correct 
>years, as the format might be different
>SET "yearsRightNow=%date:~0,4%"
>:: Download Latest version of dmd compiler for Windows, via 
>bitsadmin /Transfer "%random%" 
>"" "%cd%/dmd-%version%.exe"
>:: Launch the downloaded compiler's setup
>start "" "dmd-%version%.exe"

More information about the Digitalmars-d mailing list