# Run in its own scope when pasted into PowerShell, leaving caller preferences alone. & { $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' if ($env:OS -ne 'Windows_NT') { throw 'This installer requires Windows.' } $architecture = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE } if ($architecture -ne 'AMD64') { throw 'Windows builds currently support x64 PCs only.' } if (Get-Process -Name 'Pickware Games' -ErrorAction SilentlyContinue) { throw 'Quit Pickware Games and run this command again.' } Write-Host 'Installing the unsigned Pickware Games test build for your Windows user.' $work = Join-Path ([IO.Path]::GetTempPath()) ('pickware-install-' + [guid]::NewGuid().ToString('N')) $null = New-Item -ItemType Directory -Path $work $previousProtocol = [Net.ServicePointManager]::SecurityProtocol try { [Net.ServicePointManager]::SecurityProtocol = $previousProtocol -bor [Net.SecurityProtocolType]::Tls12 $installer = Join-Path $work 'Pickware-Games-Setup.exe' Invoke-WebRequest -UseBasicParsing -Uri 'https://games.pickware.com/api/downloads/launcher/win32-x64' -OutFile $installer $stream = [IO.File]::OpenRead($installer) try { if ($stream.ReadByte() -ne 0x4D -or $stream.ReadByte() -ne 0x5A) { throw 'The download is not a Windows executable.' } } finally { $stream.Dispose() } # Remove the download block only from this installer, not system protections. Unblock-File -LiteralPath $installer $process = Start-Process -FilePath $installer -ArgumentList '/S', '/currentuser' -Wait -PassThru if ($process.ExitCode -ne 0) { throw "Installation failed (exit code $($process.ExitCode))." } Write-Host 'Installed. Open Pickware Games from the Start menu.' } finally { [Net.ServicePointManager]::SecurityProtocol = $previousProtocol Remove-Item -LiteralPath $work -Recurse -Force } }