Look me up on

10 December 2011

Finding processes on (i.e. ps for) Windows

As part of creating some test infrastructure for a work project the other day, I was looking for a good way to find any existing / leftover processes, so I could ensure things were in a clean state at the start of each test run. On Linux this is pretty easy, using ps, but I couldn’t find a good way to do it on Windows.

And for most cases, that’s enough. But I was looking for a particular Java process and unfortunately I couldn’t tell which of the java.exe processes were the ones I was interested in and which were for something else – as tasklist doesn’t provide enough information (i.e. the launch parameters).

After a fair bit of Googling (which I’m hoping to save someone), I came accross a pretty cool command line interface called WMIC (Intro & Examples) that’s immensely powerful for gathering information from Windows-based systems (and is installed by default since Windows 2000).

It seems to do a whole load of stuff, but I was particularly interested in the process side of things and found that I could simply do: