From 0356cf91f4bc979641eb01173207de419910b7f9 Mon Sep 17 00:00:00 2001 From: Guofang Date: Sun, 18 Oct 2026 15:41:06 +0800 Subject: [PATCH] Add a script that installs ws2tcp-local from its latest release The silent installer skips the desktop shortcut option, so the script creates the shortcut itself. Co-Authored-By: Claude Sonnet 5.5 --- .../70-Install-ws2tcp-local-Admin.bat | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 seediso/windows11/70-Install-ws2tcp-local-Admin.bat diff --git a/seediso/windows11/70-Install-ws2tcp-local-Admin.bat b/seediso/windows11/70-Install-ws2tcp-local-Admin.bat new file mode 100644 index 0000000..ec86410 --- /dev/null +++ b/seediso/windows11/70-Install-ws2tcp-local-Admin.bat @@ -0,0 +1,54 @@ +@echo off +setlocal +title Install ws2tcp-local + +fltmc >nul 2>&1 +if errorlevel 1 ( + echo Please right-click this file and choose "Run as administrator". + pause + exit /b 1 +) + +set "MANIFEST=https://wangguofang.net/ws2tcp-local/releases/latest.json" +set "INSTALLER=%TEMP%\ws2tcp-local-setup.exe" + +echo Looking up the latest ws2tcp-local release... +set "URL=" +for /f "usebackq delims=" %%U in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "(Invoke-RestMethod -UseBasicParsing '%MANIFEST%').windows_url"`) do set "URL=%%U" +if not defined URL ( + echo Could not read the download URL from %MANIFEST%. + pause + exit /b 1 +) + +echo Downloading %URL%... +curl.exe -fL --retry 3 -o "%INSTALLER%" "%URL%" +if errorlevel 1 ( + echo Download failed. + pause + exit /b 1 +) + +echo Installing ws2tcp-local... +"%INSTALLER%" /S +set "RC=%ERRORLEVEL%" +del "%INSTALLER%" >nul 2>&1 + +if "%RC%"=="0" ( + call :desktop_shortcut + echo Done. +) else ( + echo The installer exited with code %RC%. +) +pause +exit /b %RC% + +:desktop_shortcut +rem The silent installer skips its "Create desktop shortcut" option. +set "EXE=%ProgramFiles%\ws2tcp-local\bin\ws2tcp-local-gui.exe" +if not exist "%EXE%" ( + echo Could not find %EXE%, skipping the desktop shortcut. + exit /b 0 +) +powershell -NoProfile -ExecutionPolicy Bypass -Command "$s=(New-Object -ComObject WScript.Shell).CreateShortcut([Environment]::GetFolderPath('CommonDesktopDirectory')+'\ws2tcp-local.lnk'); $s.TargetPath=$env:EXE; $s.WorkingDirectory=Split-Path $env:EXE; $s.Save()" +exit /b 0