1

I have finally come up with this command:

tasklist /V /NH | find "test"

It lists all running processes with "verbose" information (the "window title" is what we need, so /V must be used), skips the header line, and then pipes this into "find" to only match processes that contain "test" somewhere.

As I'm typing this, I realize that it checks for "test" anywhere in the entire line as outputted by tasklist, which is not the intention (it's supposed to only check the window title part), but this is of secondary importance since it will in practice never match since "test" is in reality a string with several spaces which is very unlikely to ever appear in the rest of the line.

Anyway, the above command takes literally seconds to run, and it's not because of the piping to "find", because I've tried it without it. It's just very sluggish at fetching this information, which you'd think would be so readily available in RAM that you'd almost get an answer before issuing the command, but apparently they are doing some convoluted logic which appears to be reading large chunks of disk storage. (How else to explain the seconds of loading each and every time?)

Having read the manual for "tasklist", there is no way to specify that I only care about the "window title" and that's all I want it to output (which might be faster).

I did notice that it's much faster if you filter by a specific "image" (EXE), but I don't want that since this is supposed to only check/care about the "window title" (also known as "process title").

Any good ideas?

1
  • 1
    You can filter by Window Title directly with /FI "WINDOWTITLE eq Window Name". Although it isn't a whole lot faster. Commented Oct 20, 2019 at 21:33

1 Answer 1

0

You can filter by Window Title with /FI "WINDOWTITLE eq Window Name". Although it isn't a whole lot faster.

You can achieve the same, but much faster with PowerShell though:

get-process | where-object {$_.mainWindowTitle -like "test*"}

Which completes within a second or so.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .