79441021

Date: 2025-02-15 05:45:02
Score: 3.5
Natty:
Report link

I have the same problem. Can't catch the arguments from a running process.

private bool IsProcessRunning(string parameter)
{
    // Check if a process with the name "NedaOPCService" is running
    // without trying to access its StartInfo
    var processes = Process.GetProcessesByName("NedaOPCService");

    foreach (var process in processes)
    {
        // Here you can check if the process matches the expected parameter
        // For instance, by matching the command line arguments (if possible)
        if (process.StartInfo.Arguments.Contains(parameter)) // If process started with the right argument
        {
            return true;
        }
    }

    return false; // No matching process found
}
Reasons:
  • Blacklisted phrase (1): I have the same problem
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same problem
  • Low reputation (1):
Posted by: Mesut Onuş