@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 MSIFILE=Installer_%PLATFORM%_%VERSION%.msi set DOWNLOAD_URL=https://s3.ap-southeast-1.amazonaws.com/updates.windows.squirrel/download/release/v%VERSION%/%PLATFORM%/Setup.msi :: Fetch the specified version of the installer echo Downloading installer version %VERSION% powershell -Command "Invoke-WebRequest -Uri '%DOWNLOAD_URL%' -OutFile '%MSIFILE%'" if errorlevel 1 ( echo Failed to download the installer. exit /b 1 ) :: Add Stub registry keys to for all Users on machine. REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\FlowaceAutoInstall" /ve /d "Flowace" /f REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\FlowaceAutoInstall" /v Version /d "%VERSION:.=,%" /f REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\FlowaceAutoInstall" /v StubPath /d "cmd.exe /c \"C:\Program Files (x86)\Flowace (%PLATFORM%) Installer\Flowace.exe\" --silent" /f REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\FlowaceOrigin" /ve /d "FlowaceOrigin" /f REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\FlowaceOrigin" /v Version /d "%VERSION:.=,%" /f REG ADD "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\FlowaceOrigin" /v StubPath /d "REG ADD \"HKEY_CURRENT_USER\SOFTWARE\Classes\flowace\" /v flowace_origin /d \"%ORIGIN%.flowace.in\" /f" /f :: Run the MSI installer msiexec /i %MSIFILE% /qb! echo Configuring Workspace-name %ORIGIN% REG ADD HKEY_CURRENT_USER\SOFTWARE\Classes\flowace /v flowace_origin /d "%ORIGIN%.flowace.in" -f :: Run the setup executable echo Installing version %VERSION% "C:\Program Files (x86)\Flowace (%PLATFORM%) Installer\Flowace.exe" --silent echo Cleaning up installation files. :: sleep for 20 second timeout /t 20 "%LOCALAPPDATA%\Flowace\FlowaceService.exe" :: Clean up REG DELETE "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Flowace" /f del /f %MSIFILE% echo Installation complete.