dwl.bat downloads a supported program archive or installer into %PRGS%\setup.
It does not install the program. Installation is handled by inst_prg.bat.
Typical usage:
dwl codex
dwl codex 0.141.0
dwl gh latestdwl.bat delegates program lookup to bin\select_prg.bat.
Supported programs are declared in bin\prgs.list:
Name/alias1/alias2~versions-or-#~folder-name-with-s~download-pattern~global
Example:
Codex/cdx~#~codexs~codex-rust-v*-x86_64-pc-windows-msvc.zip~global
Fields:
Name/alias1/alias2: names accepted on the command line.dwl codexanddwl cdxboth match the Codex entry.versions-or-#: allowed version choices.#means no fixed list; any version orlatestis accepted.folder-name-with-s: install family folder, for examplecodexs,gits,npps.download-pattern: file pattern used later byinst_prg.batto find the archive.global: optional marker used by the broader setup/profile logic.
select_prg.bat returns:
prg_id: the folder name without its trailings, for examplecodex.prg_version: the selected version orlatest.prg_pattern: the archive pattern fromprgs.list.
dwl.bat then calls a matching label:
call :dwl_%prgname%For codex, that means :dwl_codex must exist in bin\dwl.bat.
The default pattern for GitHub-hosted tools is:
:dwl_tool
set "repo=owner/repository"
if "%version%"=="latest" ( call :get_latest_version_from_github )
%_info% "Dwl (%prgname%)'%repo%' version '%version%'"
set "file=tool-%version%-windows-x64.zip"
set "url=https://github.com/%repo%/releases/download/v%version%/%file%"
call :curl
goto:eofThe common helper :get_latest_version_from_github:
- Follows
https://github.com/<repo>/releases/latest. - Extracts the final tag from the redirected URL.
- Stores the original tag in
tag. - Stores the version without a leading
vinversion. - Has special handling to avoid nightly releases when it detects a nightly tag.
The common helper :curl:
- Calls
:template. - Defaults
target_local_filetofilewhen not set. - Replaces
[v]placeholders with the resolvedversion. - Skips the download if
%PRGS%\setup\%target_local_file%already exists. - Downloads with
curl -fkL --url "%url%" -o "%PRGS%\setup\%target_local_file%".
Use the normal GitHub shape when all of these are true:
- The project is on GitHub.
latestresolves to a tag that can be converted by removing a leadingv.- The asset name contains the same version string.
- The release URL uses either
v%version%or another simple tag shape. - The downloaded filename is also the filename that should be stored in
%PRGS%\setup.
-
Add an entry to
bin\prgs.list.Tool/toolalias~#~tools~tool-*-windows-x64.zip -
Add a
:dwl_toollabel tobin\dwl.bat.:dwl_tool set "repo=owner/tool" if "%version%"=="latest" ( call :get_latest_version_from_github ) %_info% "Dwl (%prgname%)'%repo%' version '%version%'" set "file=tool-%version%-windows-x64.zip" set "url=https://github.com/%repo%/releases/download/v%version%/%file%" call :curl goto:eof
-
Run:
dwl tool inst_prg tool
-
If the active command comes from
%HOME%\bin, runsetup.bator copy the changedbinfiles to%HOME%\bin.
Not every tool follows the regular GitHub convention. Adjust the :dwl_<id> label when any part of the release flow differs.
Some projects use bare numeric tags, date tags, product prefixes, or custom prefixes.
Examples:
ripgrep: release URL uses%version%, notv%version%.msys2: release tag is a date like2024-01-13.codex: release tag isrust-v0.141.0.postman: release tag is the full Portapps version string, withoutv.
Codex normalizes common user inputs into the real release tag:
dwl codex 0.141.0 rem tag rust-v0.141.0
dwl codex v0.141.0 rem tag rust-v0.141.0
dwl codex rust-v0.141.0The stored archive is renamed with target_local_file:
set "file=codex-x86_64-pc-windows-msvc.exe.zip"
set "target_local_file=codex-%tag%-x86_64-pc-windows-msvc.zip"
set "url=https://github.com/%repo%/releases/download/%tag%/%file%"Use target_local_file when the upstream filename is too generic or does not include the version.
Many labels build the asset filename directly from %prgname%, but that only works when the asset begins with the same id.
Examples:
npp: asset isnpp.<version>.portable.x64.zip.terminal: asset isMicrosoft.WindowsTerminal_<version>_x64.zip.codex: asset iscodex-x86_64-pc-windows-msvc.exe.zip, but the local archive is versioned ascodex-rust-v...zip.
Set file explicitly in these cases.
Use a custom query when the latest version must be parsed from a website or API.
Examples:
python: readshttps://endoflife.date/api/python/<cycle>.json.jdk: reads the Adoptium API to resolve the JDK build and download link.go: scrapes the Go download page for the Windows zip.maven,eclipse,yed,treesize,ffmpeg,nexus,artifactory: parse project-specific pages.
In those labels, set version, file, and url yourself before calling :curl.
Some entries accept a major or cycle rather than an exact release.
Examples:
dwl node 22resolves the latestv22.x.y.dwl python 3.13resolves the latest Python3.13.x.dwl wildfly 35resolves the latest matching WildFly release.dwl jdk 21resolves the latest JDK 21 build.
Implement this before setting file and url.
go uses next_url and retries alternate mirrors when the first URL fails.
Use this pattern when upstream availability is unreliable:
set "url=primary"
set "next_url=fallback"
call :curl
if errorlevel 1 (
set "url=%next_url%"
set "next_url="
call :curl
)jq downloads a single .exe, copies it into a versioned directory under %PRGS%\setup, and creates a zip archive. This makes the result compatible with the default installer, which expects an archive or installable file pattern from prgs.list.
Use this only when the upstream asset is not already in a shape that inst_prg.bat can install cleanly.
python: python.org only ships an .exe installer. The portable archive python-<version>-amd64.zip matching the prgs.list pattern is built by installs\pythons.install.bat and may already be published in a setups folder. After resolving the version, :dwl_python looks for that zip in the local %PRGS%\setup, then in the remote profile setups folder and in %USERPROFILE%\senv_setups\setups (through :find_setups_zip, which copies the archive locally when found). The installer .exe is downloaded only when no zip exists anywhere.
Use :find_setups_zip in a :dwl_<prg_id> label when a senv-built archive can make the upstream download unnecessary.
A program must exist in both places:
bin\prgs.listsoselect_prg.batcan resolve names and patterns.bin\dwl.batwith a matching:dwl_<prg_id>label so the download can run.
If the command is being run from %HOME%\bin instead of this repository, update the active copy too. where dwl shows which script is used.