vikas karambalkar
vikas karambalkar

Reputation: 31

command line of process by name

I used the following command in cmd to get the process command line. It gives details of all processes:

WMIC /OUTPUT:C:\ProcessList.txt PROCESS get Caption,Commandline,Processid

I want to get the details of a particular process by name in a note pad. Thanx.

Upvotes: 3

Views: 15862

Answers (1)

dbenham
dbenham

Reputation: 130819

You can use the WHERE clause. But you didn't bother to say what process you were looking for.

If you know the processId you could use something like.

WMIC /OUTPUT:"C:\ProcessList.txt" process where processid=8196 get Caption,Commandline,Processid

An alternative to the /output option is to simply redirect the output. If you know the caption, then you can use something like:

>"c:\ProcessList.txt" wmic process where "caption='chrome.exe'" get caption,commmandLine,processId

The WHERE clause uses SQL syntax - strings are in single quotes. You can use complex logic and wild cards. The % matches any 0 or more characters, and _ matches any one character.

>"c:\ProcessList.txt" wmic process where "caption like 'c%.ex_' and processId<5000" get caption,commandLine,processId

Upvotes: 8

Related Questions