c# - Differentiating between processes with the same name outside of my application? -


i creating wpf application in c# monitor processes running on machine. want able collect list of running processes , compare them list of processes want run. if process want run not yet running, application start it.

i having problem getting processes name because have numerous processes running off of 1 parent application (they started different executable parameters,) have same process name. can't use process id because there no way me know pid of processes started outside of application. need way differentiate processes 1 both started in , outside of application can tell if running. appreciated, thanks.

as suggested here, can query command-line parameters of process wmi, doing following, example if have processid:

var wmiquery = string.format("select commandline win32_process processid='{0}'", processid); var searcher = new managementobjectsearcher(wmiquery); var retobjectcollection = searcher.get(); foreach (managementobject retobject in retobjectcollection)     console.writeline("[{0}]", retobject["commandline"]); 

you can use similar query win32_process find processid same processname.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -