4

I start a command window with a similar command:

start "DUMMYCOMMANDWINDOW"

I can then close the window using this command:

taskkill /FI "WINDOWTITLE EQ DUMMY*" /f /t

What I'd like to do, however, is to close the window based on its partial title. Something like this:

taskkill /FI "WINDOWTITLE EQ *COMMANDWINDOW" /f /t

Is there a way to do that?

  • It's not really documented, but you can use the * wildcard character only at the very end of the string. – and31415 Jun 3 '14 at 17:05
5

Using PowerShell, you can do the following:

Get-Process | Where-Object { $_.MainWindowTitle -like '*commandwindow' } | Stop-Process

Get-Process returns a list of all processes, the Where-Object clause filters it based on the window title, and Stop-Process is similar to taskkill.

1

An * cannot be at the start. Taskkill does not support it. But "COMMANDWINDOW*" should work regardless.

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.