Browse Source

Add flags and stuff to batch script

master
LoganDark 2 years ago
parent
commit
3c8c26c551
1 changed files with 95 additions and 1 deletions
  1. +95
    -1
      install-wsl.bat

+ 95
- 1
install-wsl.bat View File

@ -1,2 +1,96 @@
@echo off
powershell.exe -ExecutionPolicy ByPass "Import-Module %~dp0install-wsl.psm1; Install-WSLInteractive; pause"
if not "%1"=="" (
if "%1"=="--help" (
goto help
)
if "%1"=="--install" (
if not "%2"=="" (
if "%3"=="" (
set extra=" -InformationAction Continue"
) else (
if "%3"=="--quiet" (
set extra=" -InformationAction SilentlyContinue"
) else (
goto help
)
)
if "%2"=="wslubuntu2004" ( goto :install )
if "%2"=="wslubuntu2004arm" ( goto :install )
if "%2"=="wsl-ubuntu-1804" ( goto :install )
if "%2"=="wsl-ubuntu-1804-arm" ( goto :install )
if "%2"=="wsl-ubuntu-1604" ( goto :install )
if "%2"=="wsl-debian-gnulinux" ( goto :install )
if "%2"=="wsl-kali-linux-new" ( goto :install )
if "%2"=="wsl-opensuse-42" ( goto :install )
if "%2"=="wsl-sles-12" ( goto :install )
)
goto :help
)
if "%1"=="--cancel" (
if "%2"=="" (
set extra=" -InformationAction Continue"
) else (
if "%2"=="--quiet" (
set extra=" -InformationAction SilentlyContinue"
) else (
goto help
)
)
goto :cancel
)
if "%1"=="--windows-terminal" (
goto windowsterminal
)
goto help
)
goto default
:help
echo A wrapper script to help run the WSL installation with minimal effort.
echo.
echo Usage: install-wsl.bat --help
echo Displays all possible invocations of this script and brief descriptions of
echo each.
echo.
echo Usage: install-wsl.bat --install <distro> [--quiet]
echo Installs the given distribution. If the --quiet flag is given then no output
echo will be printed.
echo.
echo Valid distributions:
echo wslubuntu2004, wslubuntu2004arm, wsl-ubuntu-1804, wsl-ubuntu-1804-arm,
echo wsl-ubuntu-1604, wsl-debian-gnulinux, wsl-kali-linux-new, wsl-opensuse-42,
echo wsl-sles-12
echo.
echo Usage: install-wsl.bat --cancel [--quiet]
echo Cancels all pending installs. If the --quiet flag is given then no output
echo will be printed.
echo.
echo Usage: install-wsl.bat --windows-terminal
echo Installs Windows Terminal using scoop.
goto end
:install
powershell.exe -ExecutionPolicy ByPass "Import-Module %~dp0install-wsl.psm1; $a = Install-WSL -LinuxDistribution %2%extra%"
goto end
:cancel
powershell.exe -ExecutionPolicy ByPass "Import-Module %~dp0install-wsl.psm1; $a = Install-WSL -Cancel%extra%"
goto end
:windowsterminal
powershell.exe -ExecutionPolicy ByPass "Import-Module %~dp0install-wsl.psm1; $a = Install-WSL -InstallWindowsTerminal%extra%"
goto end
:default
powershell.exe -ExecutionPolicy ByPass "Import-Module %~dp0install-wsl.psm1; $a = Install-WSLInteractive"
:end

Loading…
Cancel
Save