@echo off setlocal enabledelayedexpansion if "%~2"=="" ( echo Error: Arguments are missing. echo Usage: %0 [ORIGIN] [VERSION] exit /b 1 ) set PLATFORM=x64 if not "%~3"=="" ( set PLATFORM=%~3 ) set ORIGIN=%~1 set VERSION=%~2 set ZIPFILE=Installer_%PLATFORM%_%VERSION%.zip set DOWNLOAD_URL=https://s3.ap-southeast-1.amazonaws.com/updates.windows.squirrel.stealth.generic/download/release/v%VERSION%/Flowace_Setup_%PLATFORM%.zip :: Fetch the specified version of the installer echo Downloading installer version %VERSION% powershell -Command "Invoke-WebRequest -Uri '%DOWNLOAD_URL%' -OutFile '%ZIPFILE%'" if errorlevel 1 ( echo Failed to download the installer. exit /b 1 ) :: Run the installer :: msiexec /i %INSTALLER% /qb! ORIGIN="%ORIGIN%.flowace.in" powershell -Command "Expand-Archive -Path '%ZIPFILE%' -Force" REG ADD HKEY_CURRENT_USER\SOFTWARE\Classes\flowace /v flowace_origin /d "%ORIGIN%.flowace.in" -f echo Configuring Workspace-name %ORIGIN% echo Installing version %VERSION% :: Run the setup executable Installer_%PLATFORM%_%VERSION%\Setup.exe --silent echo Cleaning up installation files. :: sleep for 20 second timeout /t 20 "%LOCALAPPDATA%\Flowace\WinFService.exe" :: Clean up REG DELETE "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Flowace" /f rmdir /s /q Installer_%PLATFORM%_%VERSION% del /f %ZIPFILE% echo Installation complete.