filter in tasklist.exe does not take wildcards?
You can use the /V option to include the window title in the output and then pipe the result to FIND (or FINDSTR) to filter the result.
tasklist /v | find "UniqueIdentifier"
tasklist /v | findstr /c:"UniqueIdentifier"
If using FINDSTR then I recommend using the /C option so that you can include spaces in the search string.
You might want to use the /I
option if you need to do a case insensitive search.
Based on my experimentation, the wildcard for taskkill only seems to work at the end of a string, not in any other position. I can't find any documentation from Microsoft one way or another about this. However all of the examples in the documentation follow this format
Successful: notepad*
Fails: notepad*.exe
Fails *notepad*
As mentioned in the other answer, best to parse the output of tasklist to get exactly what you want rather than relying on the rather broken behavior of taskkill.