Skip to content

Instantly share code, notes, and snippets.

@u01jmg3
Created April 30, 2021 08:38
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 u01jmg3/02f60715704072fcc8491f017d45ddd8 to your computer and use it in GitHub Desktop.
Save u01jmg3/02f60715704072fcc8491f017d45ddd8 to your computer and use it in GitHub Desktop.
On Windows kill hung background Notepad++ processes
@ECHO off
FOR /F "tokens=2" %%K IN ('
tasklist /FI "ImageName eq notepad++.exe" /FI "Status eq Not Responding" /FO LIST ^| findstr /B "PID:"
') DO (
:: Check for number
SET "var="&for /f "delims=0123456789" %%i in ("%%K") do set var=%%i
IF NOT DEFINED var (
:: https://processhacker.sourceforge.io/
ProcessHacker.exe -c -caction terminate -ctype process -cobject %%K
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment