From 1ca8a2e3ce2122a534d813570c0cd0c355076a52 Mon Sep 17 00:00:00 2001 From: DuProcess <273172371+DuProcess@users.noreply.github.com> Date: Thu, 16 Jul 2026 22:12:09 -0400 Subject: [PATCH] Add cmd installer entrypoint for Windows --- README.md | 6 ++++++ install.cmd | 32 ++++++++++++++++++++++++++++++++ tests/release_scripts.rs | 14 ++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 install.cmd diff --git a/README.md b/README.md index c967482..37038eb 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ Windows client: irm https://git.palav.dev/Palav/dosh/raw/branch/main/install.ps1 | iex ``` +Windows client from `cmd.exe`: + +```bat +curl -fsSL https://git.palav.dev/Palav/dosh/raw/branch/main/install.cmd -o "%TEMP%\dosh-install.cmd" && "%TEMP%\dosh-install.cmd" +``` + ## Use ```sh diff --git a/install.cmd b/install.cmd new file mode 100644 index 0000000..acbf496 --- /dev/null +++ b/install.cmd @@ -0,0 +1,32 @@ +@echo off +setlocal EnableExtensions + +set "SCRIPT_URL=%DOSH_INSTALL_PS1%" +if "%SCRIPT_URL%"=="" set "SCRIPT_URL=https://git.palav.dev/Palav/dosh/raw/branch/main/install.ps1" + +set "PS=" +for %%P in (powershell.exe pwsh.exe powershell pwsh) do ( + if not defined PS ( + where %%P >nul 2>nul && set "PS=%%P" + ) +) + +if not defined PS ( + echo missing required command: powershell.exe or pwsh.exe 1>&2 + exit /b 1 +) + +set "TMP_PS=%TEMP%\dosh-install-%RANDOM%-%RANDOM%.ps1" +set "DOSH_INSTALL_PS1_URL=%SCRIPT_URL%" +set "DOSH_INSTALL_PS1_PATH=%TMP_PS%" + +"%PS%" -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; Invoke-WebRequest -UseBasicParsing -Uri $env:DOSH_INSTALL_PS1_URL -OutFile $env:DOSH_INSTALL_PS1_PATH" +if errorlevel 1 ( + del "%TMP_PS%" >nul 2>nul + exit /b 1 +) + +"%PS%" -NoProfile -ExecutionPolicy Bypass -File "%TMP_PS%" %* +set "RC=%ERRORLEVEL%" +del "%TMP_PS%" >nul 2>nul +exit /b %RC% diff --git a/tests/release_scripts.rs b/tests/release_scripts.rs index d10f60a..9e1a437 100644 --- a/tests/release_scripts.rs +++ b/tests/release_scripts.rs @@ -235,6 +235,20 @@ fn windows_installer_bootstraps_git_for_source_fallback_like_unix() { assert!(!ps1.contains("Require-Command git")); } +#[test] +fn windows_cmd_installer_wraps_native_powershell_installer() { + let cmd = include_str!("../install.cmd"); + let readme = include_str!("../README.md"); + assert!(cmd.contains("@echo off")); + assert!(cmd.contains("https://git.palav.dev/Palav/dosh/raw/branch/main/install.ps1")); + assert!(cmd.contains("for %%P in (powershell.exe pwsh.exe powershell pwsh) do")); + assert!(cmd.contains("Invoke-WebRequest -UseBasicParsing")); + assert!(cmd.contains("-ExecutionPolicy Bypass -File \"%TMP_PS%\" %*")); + assert!(cmd.contains("exit /b %RC%")); + assert!(readme.contains("Windows client from `cmd.exe`:")); + assert!(readme.contains("install.cmd")); +} + #[test] fn windows_installer_honors_quiet_update_mode() { let ps1 = include_str!("../install.ps1");