Skip to content

Instantly share code, notes, and snippets.

@scruel
Created May 10, 2023 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scruel/0e3d85ead5eb33cd0c98c2e817d793ed to your computer and use it in GitHub Desktop.
Save scruel/0e3d85ead5eb33cd0c98c2e817d793ed to your computer and use it in GitHub Desktop.
Restart all related wsl processes
@echo off
%1 start "" mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c pushd ""%~dp0"" && ""%~s0"" ::","","runas",1)(window.close)&&exit
taskkill -IM "wslservice.exe" /F >nul 2>nul
taskkill -IM "wslhost.exe" /F >nul 2>nul
taskkill -IM "wsl.exe" /F >nul 2>nul
powershell.exe -WindowStyle Hidden -c "wsl"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment