# BLNK Installer for Windows # Usage: irm https://blnk.bcdflow.net/install.ps1 | iex $ErrorActionPreference = "Stop" $BinaryName = "blnk" $BaseUrl = "https://blnk.bcdflow.net/dist" function Info($msg) { Write-Host " -> $msg" -ForegroundColor Cyan } function Success($msg) { Write-Host " OK $msg" -ForegroundColor Green } function Warn($msg) { Write-Host " !! $msg" -ForegroundColor Yellow } function Error($msg) { Write-Host " XX $msg" -ForegroundColor Red; exit 1 } # Detect architecture $arch = if ([Environment]::Is64BitOperatingSystem) { if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "aarch64" } else { "x86_64" } } else { Error "32-bit systems are not supported" } Info "Downloading blnk (windows-$arch)..." $filename = "$BinaryName-windows-$arch.exe" $url = "$BaseUrl/$filename" $installDir = "$env:USERPROFILE\.blnk\bin" $installPath = "$installDir\$BinaryName.exe" # Create install directory if (!(Test-Path $installDir)) { New-Item -ItemType Directory -Path $installDir -Force | Out-Null } # Download $tmpFile = "$env:TEMP\$filename" try { Invoke-WebRequest -Uri $url -OutFile $tmpFile -UseBasicParsing } catch { Error "Download failed: $_" } # Install Move-Item -Path $tmpFile -Destination $installPath -Force # Add to PATH if not already $userPath = [Environment]::GetEnvironmentVariable("PATH", "User") if ($userPath -notlike "*$installDir*") { [Environment]::SetEnvironmentVariable("PATH", "$userPath;$installDir", "User") $env:PATH = "$env:PATH;$installDir" Info "Added $installDir to PATH" } # Verify if (Test-Path $installPath) { Success "Installed! Restart your terminal, then run 'blnk' to start." } else { Error "Installation failed" }