Skip to content

About

Single-file Windows batch launcher that downloads tools on first use. Rename it after a tool and run. It supports mirrors, sha256 checks, zip/tar/msi unpacking and self-update. No installer, no admin rights.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

dlexe

Русская версия

A single-file Windows batch launcher that downloads tools on first use. Name a copy of dlexe.cmd after a tool and run it. The tool is downloaded, unpacked and started. Later runs start it right away.

dlexe nodeold app.js

or, with a renamed copy:

nodeold app.js

Useful for sysadmins: one file to carry around, with download sources written right in it.

Records

What to download and how is described by records: batch labels, so they are harmless inside a .cmd file.

:dlexe/<util>[=<sha256>] "<dist>" "<url>" "<unpack>" [stdparams]
Field Meaning
<util> tool name: dlexe <util> or <util>.cmd
<sha256> optional; the download is checked before unpacking
<dist> the file to run, relative to DLEXE_ROOT (C:\ProgramData by default)
<url> where to download from
<unpack> "": the download is <dist> itself
zip: extract into the <dist> directory
tar: extract with tar.exe into the <dist> directory
anything else: a command; $f is the downloaded file, $d the <dist> directory
stdparams put before the user's arguments

Examples:

:dlexe/nodeold "/nodeold.cli/nodeold.cmd" "https://raw.githubusercontent.com/slnknrr-dev/nodeold-cli-in-batchfile-for-legacy/refs/heads/main/nodeold.cmd" ""
:dlexe/tool=9f86d0...0a08 "/tool.cli/tool.exe" "https://example.com/tool-1.2.zip" "zip"
:dlexe/app "/app.cli/app.exe" "https://example.com/setup.exe" "$f /s /outdir $d"
:dlexe/old "/old.cli/old.exe" "https://example.com/old.msi" "msiexec /a $f /qn TARGETDIR=$d"

Records must start at the very beginning of the line. Don't use quotes inside a field: $f and $d are quoted automatically.

Mirrors

Several records with the same <util> are mirrors. They are tried in order, and the first one that downloads, passes the sha256 check and unpacks wins:

:dlexe/tool "/tool.cli/tool.exe" "https://example.com/tool.exe" ""
:dlexe/tool "/tool.cli/tool.exe" "http://intranet/mirror/tool.exe" ""

If <dist> of any record is already installed, nothing is downloaded.

Where records come from

Any copy of dlexe.cmd (under any name) is a bootstrapper. It:

  1. installs the engine %DLEXE_ROOT%\dlexe.cli\dlexe.cmd if it is missing: by its own :dlexe/dlexe record, or as a copy of itself if the download fails;
  2. calls the engine with explicit sources:
"%ProgramData%\dlexe.cli\dlexe.cmd" -s <this file> -s "%UserProfile%\.dlexerc" -s "%ProgramData%\dlexe.cli\dlexe.cmd" -n <util>

So records are looked up in the called file first, then in the user's %UserProfile%\.dlexerc, then in the engine. A copy you hand to a colleague brings its own records with it.

The same record found in several sources is tried once.

Usage

dlexe [-u] <util> [args]
<util>.cmd [args]                          a renamed copy of dlexe.cmd
dlexe -s <src> [-s <src>]... [-u] -n <util> [args]
Option Meaning
-u download again; files already in the <dist> directory are kept
-s <src> a file with records; engine mode uses only the given files
-n <util> the tool; everything after it goes to the tool
-v, -h version, help

-s works for any file, for example a team file on a share:

dlexe -s \\server\share\team.dlexerc -n tool

A renamed copy passes its arguments untouched. With dlexe <util> args the arguments are rebuilt, so &, |, <, > inside them must be quoted.

Built-in tools

<util> what folder in DLEXE_ROOT
dlexe, nodeold dlexe itself and nodeold, legacy Node.js versions dlexe.cli, nodeold.cli
ffmpeg, ffplay, ffprobe FFmpeg win64 gpl (master) from FFmpeg-Builds; one zip installs all three ffmpeg.cli
yt-dlp, yt-dlp_x86, yt-dlp_arm64 yt-dlp, the latest release yt-dlp.cli
the name of any .exe on live.sysinternals.com procexp, procexp64, psexec64, autorunsc64, procmon64a (ARM64)… — 211 files sysinternals.cli
the .exe name of a NirSoft utility cports, cports64, nircmd, nircmdc, wifiinfoview, bluescreenview64… — 375 records, without the password recovery section nirsoft.cli, nirsoft.cli\x64
putty, plink, pscp, psftp, puttygen, pageant, pterm, puttytel PuTTY, the latest release putty.cli\w32, w64, wa64
7zr the single-file console 7-Zip (.7z only) 7zip.cli
jq, yq, rclone jq, yq, rclone, the latest release jq.cli, yq.cli, rclone.cli
dlexe psexec64 \\pc01 -s cmd
dlexe ffprobe -hide_banner video.mp4
dlexe nircmdc monitor off
dlexe plink64 -ssh admin@server uptime
yt-dlp "https://example.com/watch?v=..."    :: a renamed copy
  • The tool name is the file name without .exe, in any case.
  • Architecture: for Sysinternals, NirSoft and PuTTY a name without a suffix is x86, 64 is x64, 64a is ARM64; for jq, yq and rclone no suffix is x64, then -x86, -arm64; yt-dlp has _x86, _arm64.
  • ffmpeg and rclone are unpacked by the system tar.exe (Windows 10 1803 and newer). A new build: dlexe -u ffmpeg; yt-dlp updates itself: yt-dlp -U.
  • Sysinternals tools ask to accept their license on first run; console ones take -accepteula.
  • sh tools/sysinternals.sh and node tools/nirsoft.mjs build the lists; the records are refreshed from them.

Updating dlexe itself

dlexe -u dlexe

downloads the engine by the :dlexe/dlexe record and keeps your records. The engine has two blocks at the end:

rem --- dlexe: local records (kept by dlexe -u dlexe) ---
:dlexe/mytool "/mytool.cli/mytool.exe" "http://intranet/mytool.exe" ""

rem --- dlexe: built-in records (replaced by dlexe -u dlexe) ---
:dlexe/dlexe "/dlexe.cli/dlexe.cmd" "https://raw.githubusercontent.com/..." ""

Put your own records in the local block: the update keeps it as is and replaces everything else. The local block comes first, so its records win over built-in ones. A download without these markers is rejected, and the old engine is left untouched.

Downloading

  • curl (built in since Windows 10 1803) if it is there. A failed download goes to the next mirror.
  • otherwise BITS (bitsadmin). The job is cancelled on an error or after 60 seconds without progress, so a dead mirror does not hang the script.
  • %SystemRoot%\System32\curl.exe and tar.exe are preferred over the ones in PATH (Git and MSYS builds treat C: as a host name).
  • zip is extracted with tar.exe, or with Shell.Application through PowerShell on systems without it.
  • The sha256 is checked with certutil.

Environment variables

Variable Default Purpose
DLEXE_ROOT %ProgramData% the root for <dist> and the engine

Notes

  • HTTPS on old Windows. GitHub requires TLS 1.2, which Windows XP does not support and Windows 7 supports only with updates. Add an http:// mirror record for such systems.
  • Line endings. The repository stores .cmd files with CRLF (.gitattributes), so raw downloads are valid batch files.
  • Installers. Exit codes 3010 and 1641 ("reboot required") count as success.

License

MIT © 2026 Yury Slinkin

About

Single-file Windows batch launcher that downloads tools on first use. Rename it after a tool and run. It supports mirrors, sha256 checks, zip/tar/msi unpacking and self-update. No installer, no admin rights.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages