# irm https://spellbook.nitemaeric.com/install.ps1 | iex $ErrorActionPreference = "Stop" $Base = if ($env:SPELLBOOK_DOWNLOAD_BASE) { $env:SPELLBOOK_DOWNLOAD_BASE } else { "https://spellbook.nitemaeric.com" } $Version = if ($env:SPELLBOOK_VERSION) { $env:SPELLBOOK_VERSION } else { "latest" } $DestDir = if ($env:SPELLBOOK_BIN) { $env:SPELLBOOK_BIN } else { Join-Path $env:LOCALAPPDATA "Spellbook\bin" } $Arch = if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString() -eq "Arm64") { "arm64" } else { "x64" } $Name = "spellbook-windows-$Arch.exe" $Url = "$Base/cli/$Version/$Name" New-Item -ItemType Directory -Force -Path $DestDir | Out-Null $Dest = Join-Path $DestDir "spellbook.exe" Write-Host "Downloading $Url" Invoke-WebRequest -Uri $Url -OutFile $Dest Write-Host "Installed $Dest" $userPath = [Environment]::GetEnvironmentVariable("Path", "User") if ($userPath -notlike "*$DestDir*") { [Environment]::SetEnvironmentVariable("Path", "$userPath;$DestDir", "User") $env:Path = "$env:Path;$DestDir" Write-Host "Added $DestDir to your user PATH." }