Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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