Script for installing WSL on Windows 10 AME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.7 KiB

  1. @echo off
  2. if not "%1"=="" (
  3. if "%1"=="--help" (
  4. goto help
  5. )
  6. if "%1"=="--install" (
  7. if not "%2"=="" (
  8. if "%3"=="" (
  9. set extra=" -InformationAction Continue"
  10. ) else (
  11. if "%3"=="--quiet" (
  12. set extra=" -InformationAction SilentlyContinue"
  13. ) else (
  14. goto help
  15. )
  16. )
  17. if "%2"=="wslubuntu2004" ( goto :install )
  18. if "%2"=="wslubuntu2004arm" ( goto :install )
  19. if "%2"=="wsl-ubuntu-1804" ( goto :install )
  20. if "%2"=="wsl-ubuntu-1804-arm" ( goto :install )
  21. if "%2"=="wsl-ubuntu-1604" ( goto :install )
  22. if "%2"=="wsl-debian-gnulinux" ( goto :install )
  23. if "%2"=="wsl-kali-linux-new" ( goto :install )
  24. if "%2"=="wsl-opensuse-42" ( goto :install )
  25. if "%2"=="wsl-sles-12" ( goto :install )
  26. )
  27. goto :help
  28. )
  29. if "%1"=="--cancel" (
  30. if "%2"=="" (
  31. set extra=" -InformationAction Continue"
  32. ) else (
  33. if "%2"=="--quiet" (
  34. set extra=" -InformationAction SilentlyContinue"
  35. ) else (
  36. goto help
  37. )
  38. )
  39. goto :cancel
  40. )
  41. if "%1"=="--windows-terminal" (
  42. goto windowsterminal
  43. )
  44. goto help
  45. )
  46. goto default
  47. :help
  48. echo A wrapper script to help run the WSL installation with minimal effort.
  49. echo.
  50. echo Usage: install-wsl.bat --help
  51. echo Displays all possible invocations of this script and brief descriptions of
  52. echo each.
  53. echo.
  54. echo Usage: install-wsl.bat --install ^<distro^> [--quiet]
  55. echo Begins installing the given distribution. If the --quiet flag is given then
  56. echo no output will be printed. If the Windows Subsystem for Linux is not
  57. echo installed, it will be enabled and a startup item will be created to resume
  58. echo the installation on reboot.
  59. echo.
  60. echo Valid distributions:
  61. echo wslubuntu2004, wslubuntu2004arm, wsl-ubuntu-1804, wsl-ubuntu-1804-arm,
  62. echo wsl-ubuntu-1604, wsl-debian-gnulinux, wsl-kali-linux-new, wsl-opensuse-42,
  63. echo wsl-sles-12
  64. echo.
  65. echo Usage: install-wsl.bat --cancel [--quiet]
  66. echo Cancels all pending installs. If the --quiet flag is given then no output
  67. echo will be printed.
  68. echo.
  69. echo Usage: install-wsl.bat --windows-terminal
  70. echo Installs Windows Terminal using scoop.
  71. goto end
  72. :install
  73. powershell.exe -ExecutionPolicy ByPass "Import-Module \"%~dp0install-wsl.psm1\"; $a = Install-WSL -LinuxDistribution %2%extra%"
  74. goto end
  75. :cancel
  76. powershell.exe -ExecutionPolicy ByPass "Import-Module \"%~dp0install-wsl.psm1\"; $a = Install-WSL -Cancel%extra%"
  77. goto end
  78. :windowsterminal
  79. powershell.exe -ExecutionPolicy ByPass "Import-Module \"%~dp0install-wsl.psm1\"; $a = Install-WSL -InstallWindowsTerminal%extra%"
  80. goto end
  81. :default
  82. powershell.exe -ExecutionPolicy ByPass "Import-Module \"%~dp0install-wsl.psm1\"; $a = Install-WSLInteractive"
  83. :end