Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 714797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:06:54+00:00 2026-05-14T05:06:54+00:00

Scenario I have a method that returns a list of processes using WMI. If

  • 0

Scenario

I have a method that returns a list of processes using WMI.
If I have 3 processes running (all of which are C# applications) – and they all have THE SAME PROCESS NAME but different command line arguments, how can I differentiate between them If I want to start them or terminate them!?

Thoughts

As far as I can see, I physically cannot differentiate between them, at least not without having to use the Handle, but that doesn’t tell me which one of them got terminated because the others will still sit there with the same name……..

….really stumped, help greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:06:55+00:00Added an answer on May 14, 2026 at 5:06 am

    The WMI Win32_ProcessObject has a CommandLine property you could use if that is what you know differentiates the instances.

    string query = “Select * From Win32_Process Where Name = “ + processName;
    ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
    ManagementObjectCollection processList = searcher.Get();
    
    foreach (ManagementObject obj in processList)
    {
         string cmdLine = obj.GetPropertyValue("CommandLine").ToString();
    
         if (cmdLine == "target command line options")
         {
              // do work
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The scenario I am using LINQ is as follows: I have a method that
Consider the following scenario. I have a method which returns ISomething , but it
Here's the scenario; I have a list of CustomerIds (1, 2, 3) that have
I have a scenario where i am calling a Controller method from the view,that
Picture the following scenario: I have a DataGrid which I've bound to a list
In a multithreaded scenario, I have a method like this: bool WaitForChange( time_duration WaitTime
Say I have a simple client/server scenario with one method: // client code $client
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Scenario: I have a console application that needs to access a network share with
Scenario: I have a partial view that is used in several places across my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.