Process command line by name

I used the following command in cmd to get the process command line. It gives detailed information about all the processes:

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

I want to get information about a specific process by name in notepad. Thanx.

+2
windows cmd
source share
1 answer

You can use the WHERE clause. But you did not bother to say what process you were looking for.

If you know processId, you can 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 title, 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 enclosed in single quotes. You can use complex logic and wild cards. % matches any 0 or more characters, and _ matches any character.

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

All Articles