-
Notifications
You must be signed in to change notification settings - Fork 0
/
wslstart.cmd
executable file
·46 lines (38 loc) · 1.14 KB
/
wslstart.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@echo off
goto :init
:usage
@echo Usage: wslstart.cmd [reboot^|shutdown^|help]
@echo reboot: shutdown the default WSL session before start it
@echo shutdown: shutdown the default WSL session and quit
@echo help: print usage and quit
@echo no parameters: just start the default WSL session normally
@goto :exit
:shutdown
@rem shutdown and quit
@echo Shutting down WSL...
@wsl --shutdown
@timeout /nobreak 8
@goto :exit
:reboot
@rem shutdown and continue
@echo Rebooting WSL...
@wsl --shutdown
@timeout /nobreak 8
@goto :start
:init
@if "%1"=="help" goto :usage
@if "%1"=="shutdown" goto :shutdown
@if "%1"=="reboot" goto :reboot
@if "%1"=="" goto :start
@goto :usage
:start
@rem use smaller window
@mode con:cols=66 lines=10
@set PROMPT=#
@rem start putty pageant
@set PUTTYDIR=%HOMEDRIVE%%HOMEPATH%\WinUtils\puttyall
@set KEYDIR=%HOMEDRIVE%%HOMEPATH%\WinUtils\puttyall\Keys
@start /b %PUTTYDIR%\PAGEANT.EXE %KEYDIR%\mykey.ppk
@rem execute wslstart, which executes /etc/wslstart.sh
@wsl /usr/sbin/wslstart
:exit