command line of process by name

2019-07-17 11:47发布

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.

标签: windows cmd
1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-07-17 12:08

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
查看更多
登录 后发表回答