Skip to content

Path of running application.

balram mallick

balram mallick

Asked Apr 25, 2008, 4:09 PM EDT1 answer
Share
LinkedInX

Hi,

i need path of all running application. if we have two ms-word doc file, so how i can find path of this two file. i find path of notepad using

ManagementClass MgmtClass = new ManagementClass("Win32_Process");

and CommandLine property. it gives only path of notepad allpication only, but not work in the case of word,xls file.

plz help me

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    - not sure if I understand exactly what you're asking - but if I do then something like this might work:

    C#
                string currentProcess;
                int searchCount = 0;
                Array processArray = Process.GetProcesses();
                searchCount = 0;
                itIsRunning = false;
                while (searchCount < processArray.Length)
                {
                    currentProcess = processArray.GetValue(searchCount).ToString();
                    if (currentProcess == "System.Diagnostics.Process (the_process_I_am_looking_for)")
                    {
                        itIsRunning = true;
                        searchCount = processArray.Length;
                    }
                    searchCount++;
                }
    0