How to kill all Windows processes by a program's file name?

Specify the /im parameter of taskkill:

taskkill /f /im <the program's file name>

E.g.:

taskkill /f /im bash.exe

2023-05-25--23-39-35

learn.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill#examples