I need to kill foo.exe, but only under a certain user account. Is this possible with taskkill? In this case, killing all instances of foo.exe would be problematic.

taskkill /F /T /IM foo.exe /FI "USERNAME eq target_user"

should do it. /IM specifies the image name, and the /FI option specifies a filter to use, in this case, a user with the username "target_user".

In any case, you'll need to be an Administrator on the local system to forcefully terminate processes in another users security context

| improve this answer | |
  • If you do not want to hard-code username, use %USERNAME% or %USERDOMAIN%\%USERNAME% for current user. – Salman A Aug 16 '18 at 8:04

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.