Skip to content

Kill A Process With A Specific Command Line From The Command-Line In Windows

You learn something new every day!

After a bit of wrestling with windows’ tasklist and taskkill tools, I finally took to the fabulous interweb and came up with this, viz:

wmic Path win32_process Where "Caption Like '%java.exe%' AND CommandLine Like '%groovy.home%'" Call Terminate

I knew about WMIC, but I didn’t appreciate how versatile it actually was.

I do now!

PS: I also appreciate the PowerShell version so I guess that makes two things I have learned today.


C, Java Enterprise Edition, JEE, J2EE, JBoss, Application Server, Glassfish, JavaServer Pages, JSP, Tag Libraries, Servlets, Enterprise Java Beans, EJB, Java Messaging Service JMS, BEA Weblogic, JBoss, Application Servers, Spring Framework, Groovy, Grails, Griffon, GPars, GAnt, Spock, Gradle, Seam, Open Source, Service Oriented Architectures, SOA, Java 2 Standard Edition, J2SE, Eclipse, Intellij, Oracle Service Bus, OSB