Here’s a batch file partially inspired by this question by Rogier:
for /F "delims=" %%a in ('tasklist /fo list /v') do (
call :Sub %%a
if "%BOL4%"=="PID:" (
if "%BOL13%"=="Window Title:" ( // Note . below.
echo %Value% | findstr /r /c:"- Conversation.$" > nul
if not errorlevel 1 (
REM taskkill /pid %save_PID%
I found that I needed to add a
. at the end of the regular expression for the
| findstr /rregular expression ending with $
form to work. I’m guessing that
echo is adding a CR or maybe an extra CRLF to the string, and that
findstr is counting that as a character occurring between the string and the end of the line.
Obviously you will un-comment-out the
taskkill command one you have tested this.