Simple C# function to find an executable being run in the path

public string FindInPath(string filenameToFind)

{

string Path = System.Environment.GetEnvironmentVariable("PATH");

string[] folders = Path.Split(new char[] {';'});

foreach (string folder in folders)

{

DirectoryInfo dirInfo = new DirectoryInfo(folder);

if (dirInfo != null)

{

FileInfo[] files = dirInfo.GetFiles();

foreach (FileInfo file in files)

if (file.Name.ToLower().Contains(filenameToFind))

    return dirInfo.ToString();

}

}

return string.Empty;

}

Main post is @ http://cmohan.spaces.live.com