39

I'm trying to kill a process on GitBash on Windows10 using the taskkill command. However, I get the following error:

$ taskkill /pid 13588
ERROR: Invalid argument/option - 'C:/Program Files/Git/pid'.
Type "TASKKILL /?" for usage.

it works fine on cmd. Can anyone help?

6 Answers 6

86

You have to use double slashes in this case:

taskkill //PID 13588

This is documented here: http://www.mingw.org/wiki/Posix_path_conversion
Look at the examples on this page, especially the //foobar example.

6
  • 5
    taskkill -F //PID 1848 // To force termination
    – Velu
    Dec 13, 2017 at 8:39
  • I have the same problem on one of my Windows 8.1 machines, but on the other one, the problem is the opposite; double slashes get me "Invalid argument/option", but single slashes work. Any ideas?
    – Dhi
    Aug 17, 2018 at 7:20
  • none of these approaches worked for me, I just wanted a bg PID and I get "no such a job" Error again Mar 7, 2019 at 17:58
  • try this --> taskkill //PID 2651 -F
    – papski
    Apr 28, 2022 at 8:56
  • Also taskkill //PID 12560 //F worked for me (double slashes on every params) Dec 1, 2022 at 16:31
18

Use TSKILL processid

Example:

TSKILL 1234 
2
  • 2
    make sure to use the WPID to identify the process to kill (not the PID) Dec 24, 2019 at 14:15
  • @EnricoGiurin great point, you can < /proc/1234/winpid xargs tskill
    – CervEd
    Jan 25 at 10:28
6

To fix this I need to kill another additional program:

taskkill //F //IM "git-bash.exe"
taskkill //F //IM "bash.exe"
3

To delete the child processes as well, use the "/T" argument.

taskkill //PID 13588 //T

use double slashes before argument.

0

This is what actually worked for me:

taskkill /F /IM mintty.exe
0

What worked for me:

Run Git Bash as administrator

taskkill -f -fi "services eq msiserver"

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.