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

Eugene Wissner belka at
Tue Dec 17 18:08:05 UTC 2019

On Tuesday, 17 December 2019 at 16:55:56 UTC, BoQsc wrote:
> 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 extension
> Examples:
> download-dmd.cmd
> download-dmd.bat
> .cmd and .bat extensions are the same thing, no worries about 
> that.
>>:: 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
>>	TIMEOUT "2"
>>	CLS
>>	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"

This is the same thing GNOME does. And it allows to automate 
compiler updates and allows to figure out what is the latest 
version (useful for tools). "dmd-latest.deb" or similar is more 
useful for human beings but is less "generic" approach since a 
tool wouldn't know what version it is. And imho there is the 
homepage for humans which always displays the latest version.

More information about the Digitalmars-d mailing list