command line of process by name

14,894

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
Share:
14,894
vikas karambalkar
Author by

vikas karambalkar

Updated on June 05, 2022

Comments

  • vikas karambalkar
    vikas karambalkar almost 2 years

    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.