Skip to content

Instantly share code, notes, and snippets.

@t-mat
Created May 4, 2024 17:16
Show Gist options
  • Save t-mat/67775f8b0b8e91dd5ca6e41ae8cc0ad6 to your computer and use it in GitHub Desktop.
Save t-mat/67775f8b0b8e91dd5ca6e41ae8cc0ad6 to your computer and use it in GitHub Desktop.
[Windows] Download and run Alpine Linux on WSL
@echo off
setlocal EnableDelayedExpansion
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "_ESC=%%E"
cd /d "%~dp0"
set /a _E =0
set /a _E+=1 && if not exist "Alpine.zip" ( curl -JOL https://github.com/yuk7/AlpineWSL/releases/download/3.18.4-0/Alpine.zip )
set /a _E+=1 && if not exist "Alpine.zip" goto :ERROR
set /a _E+=1 && if not exist "Alpine.exe" ( tar -xkf .\Alpine.zip )
set /a _E+=1 && if not exist "Alpine.exe" goto :ERROR
set /a _E+=1 && .\Alpine.exe || goto :ERROR
echo %_ESC%[2K %~n0 : Status =%_ESC%[92m OK %_ESC%[0m
set /a errorno=0
goto :END
:ERROR
echo %_ESC%[2K %~n0 : ErrorCode = %_E%
echo %_ESC%[2K %~n0 : Status =%_ESC%[91m NG %_ESC%[0m
set /a errorno=1
:END
exit /B %errorno%
@t-mat
Copy link
Author

t-mat commented May 4, 2024

cmd.exe
cd /d "%PUBLIC%"
md AlpineWSL
cd AlpineWSL
curl.exe -LJ https://gist.githubusercontent.com/t-mat/67775f8b0b8e91dd5ca6e41ae8cc0ad6/raw/AlpineWSL.run.bat | find.exe "" /V > AlpineWSL.run.bat
.\AlpineWSL.run.bat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment