I'm trying to create a function in my .bashrc to run in gitbash. The command I'm trying to run is:
cmd '/C TASKKILL /fi "WINDOWTITLE eq Windows Task Manager"'
I'll be changing the "Windows Task Manager" bit, but just to show what I'm trying. The command (TASKKILL /fi "WINDOWTITLE eq Windows Task Manager") works fine when I run it through Windows cmd, but when I run from gitbash, I get this error message:
ERROR: Invalid argument/option - 'eq'.
Type "TASKKILL /?" for usage.
As I said, it works fine in cmd, so I'm thinking it's something to do with the quotation marks. I've also tried the following, which also fails:
cmd "/C TASKKILL /fi \"WINDOWTITLE eq Windows Task Manager\""
I could put the command in a .bat file and run that (cmd "/C pathtofile/script.bat") and that works, but I'd prefer to run it straight from the .bashrc, if possible.
ctrl+c in gitbash on windows terminal kills ssh remote sessions #12431.
Taskkill is a program that needs administrative privileges to kill a task. If you start command prompt as admin and run the same command, it will succesfully kill the task.
Copying and Pasting in Git BashCtrl+C interrupts the currently running command, while Ctrl+V tells the terminal to treat the next typed character as a literal, (e.g. to literally add a keyboard combo such as Ctrl+C ).
If you want to explore what's available, type taskkill /? then hit Enter. This will reveal some powerful options for using Task Kill. For example, if you want to kill a group of programs, type: TASKKILL /PID 1230 /PID 1241 /PID 1253 /T.
cmd "/C TASKKILL /fi "WINDOWTITLE eq Windows Task Manager""
It seems like it shouldn't work due to how the quotation marks are nested, but it does.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With