2

I want to detect whether a process with a certain name and also specific command line arguments is already running. I use Process.GetProcessesByName to get the list of processes and tried to check the argument field of each processes StartInfo property - it's always empty. Why?

I tried starting with administrative rights. I worked around the issue by using a WMI query eventually, but am not satisfied ...

joe
  • 8,344
  • 9
  • 54
  • 80

1 Answers1

1

As Steve commented, this is a possible duplicate. But to respond here, the Process.StartInfo will only work if you have launched the application this way. WMI will be the only way yo go I think via the the other solution:

How to read command line arguments of another process in C#?

Why was the WMI solution not satisfying?

Good Luck.

Community
  • 1
  • 1
XikiryoX
  • 1,898
  • 1
  • 12
  • 33
  • It was not satisfying because I didn't understand why the original idea was not working - now I do and am satisfied – user2902034 Oct 21 '13 at 08:17
  • no problem - if this (or any other answer that might come up) answers the question for you, don't forget to accept the answer. – XikiryoX Oct 21 '13 at 08:20