Jump to content

How to get the name of an PID/ProcessID


Go to solution Solved by KaFu,

Recommended Posts

Hello,

I have a List of PID, for which I need the Name. I don't kown the Name of what I want, so I make some examples:

I want the Name "Spotify" from the Spotify App, and I have the ProcessID of the instance.

Is this possible?

Greetings Flo

Link to comment
Share on other sites

Sry, I try to explain ist.

I have some Code, which gets the PIDs and the Processnames of all Processes/Programms, which have an AudioSession.

My Problem is, that this Proccesname kann look like this: "msedgewebview2.exe". But the Name I need, what hides behind this ist "Microsoft Teams".

Link to comment
Share on other sites

Not even a crystal ball can do this. WebView2 is not used just by Teams but Widgets, Office, Outlook, Weather and many other applications. What you can try it's to find the window(s) associated with your process that are not owned and based on the window title you might figure out what kind of application it is. Anyway this is an inconsistent way to kinda solve what you want.

When the words fail... music speaks.

Link to comment
Share on other sites

  • Solution

Is this of any help?

#include <array.au3>
#include <WinAPIProc.au3>

Local $aProcessList = ProcessList()

Global $aProcessList_Enhanced[UBound($aProcessList)][6]
$aProcessList_Enhanced[0][0] = $aProcessList[0][0]

For $i = 1 To $aProcessList[0][0]
    $aProcessList_Enhanced[$i][0] = $aProcessList[$i][0]
    $aProcessList_Enhanced[$i][1] = $aProcessList[$i][1]
    $aProcessList_Enhanced[$i][2] = _WinAPI_GetProcessFileName($aProcessList[$i][1])
    $aProcessList_Enhanced[$i][3] = FileGetVersion($aProcessList_Enhanced[$i][2], "FileDescription")
    $aProcessList_Enhanced[$i][4] = FileGetVersion($aProcessList_Enhanced[$i][2], "InternalName")
    $aProcessList_Enhanced[$i][5] = FileGetVersion($aProcessList_Enhanced[$i][2], "ProductName")
Next

_ArrayDisplay($aProcessList_Enhanced)

 

Link to comment
Share on other sites

You're welcome 🙂. Maybe querying for the parent process and including elevated process is of any further help?

#RequireAdmin

#include <array.au3>
#include <WinAPIProc.au3>

Local $aProcessList = ProcessList()

Global $aProcessList_Enhanced[UBound($aProcessList)][11]
$aProcessList_Enhanced[0][0] = $aProcessList[0][0]

For $i = 1 To $aProcessList[0][0]
    $aProcessList_Enhanced[$i][0] = $aProcessList[$i][0]
    $aProcessList_Enhanced[$i][1] = $aProcessList[$i][1]
    $aProcessList_Enhanced[$i][2] = _WinAPI_GetProcessFileName($aProcessList[$i][1])
    $aProcessList_Enhanced[$i][3] = FileGetVersion($aProcessList_Enhanced[$i][2], "FileDescription")
    $aProcessList_Enhanced[$i][4] = FileGetVersion($aProcessList_Enhanced[$i][2], "InternalName")
    $aProcessList_Enhanced[$i][5] = FileGetVersion($aProcessList_Enhanced[$i][2], "ProductName")
    $aProcessList_Enhanced[$i][6] =_WinAPI_GetParentProcess($aProcessList_Enhanced[$i][1])
    $aProcessList_Enhanced[$i][7] = _WinAPI_GetProcessFileName($aProcessList[$i][1])
    $aProcessList_Enhanced[$i][8] = FileGetVersion($aProcessList_Enhanced[$i][7], "FileDescription")
    $aProcessList_Enhanced[$i][9] = FileGetVersion($aProcessList_Enhanced[$i][7], "InternalName")
    $aProcessList_Enhanced[$i][10] = FileGetVersion($aProcessList_Enhanced[$i][7], "ProductName")
Next

_ArrayDisplay($aProcessList_Enhanced)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...