How do I get list of Process Names running, in VB.NET?
I need to get a list of running processes, by name, and test if "processname" is a substring of the name.
You could use:
Dim procExists as Boolean = Process.GetProcesses().Any(Function(p) p.Name.Contains(processName))
This will look through all of the processes, and set the procExists
value to True if any process which contains processName
exists in the currently executing processes. This should handle the existence of the unknown version number as well as the *32
that may occur if you're running on a 64bit OS (that's the WOW64 flag saying that it's a 32bit process running on a 64bit OS).
You can loop through the running processes like this:
For Each p As Process In Process.GetProcesses()
Debug.WriteLine(p.ProcessName)
Next