Zend certified PHP/Magento developer

test if program is running in windows, return 0 or 1

I’m trying to test and gracefully stop a program (qbittorrent) from running in windows.
I’m can partially accomplish this using
tasklist /FI "IMAGENAME eq qbittorrent.exe"
however it’s returning info. I’m wanting a command to return a boolean value, so I can run this as a test, and then continue to kill the task gracefully (taskkill /im qbittorrent.exe) in a loop until it does. The program sometimes requires a few times, so I want it to loop.

How can I do this?
thank you