all groups > dotnet windows forms > october 2006 >
You're in the

dotnet windows forms

group:

Identify the Path of a Running Windows Service


Identify the Path of a Running Windows Service Ragu
10/13/2006 1:06:02 AM
dotnet windows forms:
Hi All

I have to get the path of a Running Windows Service from another application.
How to do this ?
Re: Identify the Path of a Running Windows Service Bryan Phillips
10/15/2006 7:58:09 PM
Here is an example to get the path of a running windows service based on
the process's name:

Console.WriteLine("Find the McShield process.");
Process[] processes = Process.GetProcessesByName("McShield");

if (processes.Length==0)
{
Console.WriteLine("Could not find McShield process..");
return;
}

Process mcshield = processes[0];

Console.WriteLine("The path of the McShield process is: " +
mcshield.MainModule.FileName);

Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com




[quoted text, click to view]
AddThis Social Bookmark Button