有什么方法可以用C或CMD在Windows中获取进程描述吗?

问题描述 投票:0回答:1

有谁知道如何通过 PID 获取进程的描述吗?

  • 主要问题是同一个exe可以有多个进程;
  • 通过 CMD 命令我可以获取每个进程的 PID,但区分每个进程所做的唯一方法是通过任务管理器的详细信息选项卡中可以看到的描述;
  • 我没有找到任何CMD命令。我相信解决方案是通过 C 代码。
  • 主要目标是创建一个简单的 exe,仅返回进程详细信息,例如:getprocessdetail.exe ->“进程描述”。

下面是一个例子,它是葡萄牙语的,但我相信你能理解。 Windows Task Manager

我尝试使用 powershel 的 Get Process 和任务列表,但它们都没有返回描述。

 Id ProcessName    Description             MainWindowTitle
   -- -----------    -----------             ---------------
 1272 msedgewebview2 Microsoft Edge WebView2
12580 msedgewebview2 Microsoft Edge WebView2 [AO VIVO] JOGO ABERTO - 04/03/2024 - YouTube
14612 msedgewebview2 Microsoft Edge WebView2
16496 msedgewebview2 Microsoft Edge WebView2
36736 msedgewebview2 Microsoft Edge WebView2
37456 msedgewebview2 Microsoft Edge WebView2
37636 msedgewebview2 Microsoft Edge WebView2
39180 msedgewebview2 Microsoft Edge WebView2
c cmd exe
1个回答
0
投票

以下 PowerShell 命令将提供您所需的数据:

Get-Process explorer | Format-List Id, ProcessName, Description, MainWindowTitle

如果您想查看可检索的所有属性的列表,请使用:

Get-Process explorer | Format-List *

请参阅 Get-Process 了解更多详细信息。

© www.soinside.com 2019 - 2024. All rights reserved.