1

So basically how can I get the name of the processes in the task manager using c++ or python ( I mean the name of the application in processes not in detail like a picture) enter image description here

most of the code that I found when I searched shows names in detail, not in processes

zkz
  • 21
  • 2
  • if I understand your question, do you need only the name of the running software and you don't care about the actual process? – shai gindin Jun 05 '22 at 08:00
  • to be clear for you @shaigindin i want the name of running software with children processes for example I want four output (or names) for alteryx designer program as show in pic – zkz Jun 05 '22 at 08:16

2 Answers2

1

You can use tasklist /APPS command to know all processes and then filter one you need.

import os
print([i.split("\n") for i in os.popen("tasklist /APPS /FO \"LIST\"").read().split("\n\n")])

example output:

[['Image Name:   Cortana.exe (App)', 'PID:          17576', 'Mem Usage:    61,176 K', 'Package Name: Microsoft.549981C3F5F10_4.2203.4603.0_x64__8wekyb3d8bbwe'], ...]
wowkoltyy
  • 23
  • 7
0

You can try this on python here are some example codes before copying, install first the wmi using

py -m pip install wmi

import wmi

# Initializing the wmi constructor
f = wmi.WMI()

# Printing the header for the later columns
print("pid Process name")

# Iterating through all the running processes
for process in f.Win32_Process():
    
    # Displaying the P_ID and P_Name of the process
    print(f"{process.ProcessId:<10} {process.Name}")

for more detail, you can look here Python Get List running processes

Jericho
  • 49
  • 9
  • this shows names of processes in detail windows not in processes windows – zkz Jun 05 '22 at 08:20
  • 1
    Oh yeah sure here are some discussion about subprocesses hope it help [Subprocesses](https://stackoverflow.com/questions/3162096/how-do-you-list-all-child-processes-in-python) – Jericho Jun 05 '22 at 08:29
  • I saw this but unfortunately is not what I want – zkz Jun 05 '22 at 08:38