Advertisement
Combreal

configureUbuntu.bat

Jun 2nd, 2020
1,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.99 KB | None | 0 0
  1. @echo off
  2. :start
  3. set WSLExec=c:\Users\%username%\UbuntuWSL\ubuntu1804.exe
  4.  
  5. rem runas /trustlevel:0x20000 "cmd /c %WSLExec% install --root"
  6. %WSLExec% install --root"
  7. %WSLExec% run /mnt/c/Users/%username%/UbuntuWSL/install/configureUbuntu.sh %username%"
  8. %WSLExec% config --default-user %username%"
  9.  
  10. copy %WSLExec% c:\Users\%username%\Desktop
  11.  
  12. bash -c ls >nul: 2>nul:
  13. if %ERRORLEVEL% NEQ 0 (
  14.   wslconfig /u Ubuntu-18.04
  15. )
  16.  
  17. if exist %~dp0marker (
  18.    rem call :MessageBox "Something wrong happened during Ubuntu WSL installation"
  19.     rem call :MessageBox "Ubuntu WSL installation is complete"
  20.     del %~dp0marker
  21.     del "%~f0"
  22.     goto :eof
  23. )
  24.  
  25. bash -c ls >nul: 2>nul:
  26. if %ERRORLEVEL% NEQ 0 (
  27.   type nul >>%~dp0marker & copy %~dp0marker +,,
  28.   goto start
  29. ) else (
  30.   call :MessageBox "Ubuntu WSL installation is complete"
  31.   del "%~f0"
  32.   goto :eof
  33. )
  34.  
  35. exit 0
  36.  
  37. :MessageBox
  38. echo wscript.quit MsgBox ("%~1", 0, "UbuntuWSL") > "%~dp0infobox.vbs"
  39. wscript /nologo "%~dp0infobox.vbs"
  40. del "%~dp0infobox.vbs"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement