@echo off
REM One-step Loop installer. Download this file and double-click it.
REM It reads the manifest, downloads the latest Loop, extracts it here, and
REM runs the installer.
title Get Loop
cd /d %~dp0

powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$ErrorActionPreference='Stop';" ^
  "$m = Invoke-RestMethod 'https://loop.weedhahaha.com/manifest.json';" ^
  "$u = $m.loop.url; $v = $m.loop.version;" ^
  "Write-Host \"Downloading Loop $v...\";" ^
  "$zip = Join-Path $env:TEMP 'loop.zip';" ^
  "Invoke-WebRequest $u -OutFile $zip;" ^
  "Expand-Archive -Force $zip -DestinationPath $PWD;" ^
  "$dir = Join-Path $PWD \"Loop-$v\";" ^
  "Write-Host \"Installing in $dir\";" ^
  "Start-Process -Wait -WorkingDirectory $dir -FilePath (Join-Path $dir 'install.bat')"

if errorlevel 1 (
    echo.
    echo  Install failed - screenshot this window and send it over.
)
pause
