I need to write a batch program to end all MS office communicator tasks with window titles (usually ending with pattern "- Conversation" .

I tried

taskkill /FI "WINDOWTITLE eq *Conversation" /IM communicator.exe

but the wildcard pattern starting with a '*' does not seem to work. Gives the folowing error

ERROR: The search filter cannot be recognized.

any suggestions for a workaround would be greatly appreciated!

  • 1
    '*' Can't work in the beginning of the filtered text – Ofiris Dec 10 '12 at 17:18

Here’s a batch file partially inspired by this question by Rogier:

@echo off

for /F "delims=" %%a in ('tasklist /fo list /v') do (
      call :Sub %%a
exit /b

set Line=%*
set BOL4=%Line:~0,4%
set BOL13=%Line:~0,13%
set Value=%Line:~14%
if "%BOL4%"=="PID:" (
      set save_PID=%Value%
      exit /b
if "%BOL13%"=="Window Title:" (                          // Note . below.
      echo %Value% | findstr /r /c:"- Conversation.$" > nul
      if not errorlevel 1 (
            echo %save_PID%
            REM taskkill /pid %save_PID%
      exit /b
exit /b

I found that I needed to add a . at the end of the regular expression for the

echostring| 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.


I do appreciate the Batch file answer that uses a FOR command.

Here is another method, presented here simply as an additional option. The approach is rather different than the other answer that is provided.

First, see if you can find the MS Communicator processes with WMIC. e.g.:


Or, to show information horizontally in a table instead of vertically in Property=Value format, do:


or perhaps, to limit that down:


(and ignore the first line)

This doesn't seem to show Window title, but may show lots of other bits of information that may be used to uniquely identify Communicator instances, like Executable names.

Then, you can start getting more aggressive, narrowing down your findings. The following looks for instances that end with "name.exe" (e.g., "filename.exe", "myname.exe")

WMIC PROCESS WHERE "Description like '%%name.exe'" LIST FULL /FORMAT:TABLE

All that was just research to fine-tune your command. (After all, you don't really want to start terminating the wrong processes.)

Finally, once all your research is done, so you know you can list just the stuff you want to terminate, then start killing.

WMIC PROCESS WHERE "Description like '%%name.exe'" DELETE

The really nice part about this method is you quickly find ways to be able to gather lots of information that can be used for automation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.