Windows Batch file - taskkill if window title contains text -
i want write simple batch file kill process contains text in window title. right have: taskkill /fi "windowtitle eq xxxx*" /im cmd.exe and works, except want use wildcard both @ beginning , end of title. like: taskkill /fi "windowtitle eq \*x*" /im cmd.exe but tried , not work. there i'm missing or not possible? no, wildcards not allowed @ start of filter. for /f "tokens=2 delims=," %%a in (' tasklist /fi "imagename eq cmd.exe" /v /fo:csv /nh ^| findstr /r /c:".*x[^,]*$" ') taskkill /pid %%a this retrieve list of tasks, in csv , verbose format (that include window title last field in output). the list filtered findstr regular expression search indicated text (the x ) in last field. if line matches filter, for tokenize it, retrieving second field (the pid) used in taskkill end process.