I use X64-based Win10. Recently, I started to use git, so I am switching the console to bash/mingw64. But I don't quite understand the way bash behaves.

I tried to kill a program, say notepad, via command line. Supposedly,

TASKKILL /IM notepad.exe


I check the help documentation of taskkill in Bash. This line is in fact one of the EXAMPLES.

However, I got this error

$ TASKKILL /IM notepad.exe 

ERROR: Invalid argument/option - 'C:/Program Files/Git/IM'.

Also, TASKKILL /PID <number> doesn't work either, and same error comes out.

May someone explain what might go wrong?

P.S. This can be solved by type cmd, which then runs the command in cmd and works. But it is kind of slow, and arrows don't work(annoying).

  • 1
    Does it work if you double the slash (TASKKILL //IM notepad.exe)? – Julie Pelletier May 21 '16 at 4:19
  • Tried. I also used > help taskkill to look for info about taskkill, and it signaled the error "bash: help: no help topics match taskkill'. Try help help' or man -k taskkill' or info taskkill'." But if I use >taskkill /?, it brings out the help documentation; meanwhile >help time (for example) works. – Flowing Cloud May 21 '16 at 4:39
  • What happens if you try running these five commands? which taskkill ; type taskkill ; echo ${WINDIR} ; /windows/system32/taskkill.exe /IM notepad.exe ; CMD /C TaskKill /IM notepad.exe – TOOGAM May 21 '16 at 5:24
  • which taskkill----/c/windows/system32/taskkill /// type taskkill--- taskkill is hashed (/c/windows/system32/taskkill) //// echo ${WINDIR}--- C:\WINDOWS /// /windows/system32/taskkill.exe /IM notepad.exe---- bash: /windows/system32/taskkill.exe: No such file or directory/// CMD /C TaskKill /IM notepad.exe---- Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation. All rights reserved. – Flowing Cloud May 21 '16 at 5:41
  • forgot to mention: if I use cmd //c taskkill //im notepad.exe ; then it works. I am sorry for the last comment; I was in a hurry and forgot to use formatting. – Flowing Cloud May 21 '16 at 6:55

here is your solution use tskill instead of taskkill

Use $ tskill notepad

  • Unfortunately; this is what I get>bash: tskill: command not found – Flowing Cloud May 21 '16 at 5:38
  • How do you start notepad ? i do start notepad to open notepad and to close tskill notepad . make sure you have added git bash PATH in your Environmental variable path – user595649 May 21 '16 at 6:41
  • start is not a problem. That's where I don't understand: for some command it works fine; others, not so fine. The one in my enviroment is C:\MinGW\bin, is it correct? Or am I missing something? – Flowing Cloud May 21 '16 at 6:52
  • Add this path and try again C:\Program Files\Git\cmd – user595649 May 21 '16 at 6:58
  • added it, restarted it, but doesn't work. But I tried this command in cmd directly, which says tskill is not recognized as an internal or external command, operable program or batch file. – Flowing Cloud May 21 '16 at 7:41

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.