Simple C# function to find an executable being run in the path
original post @ http://bschandramohan.blogspot.com/2007/10/perl-script-to-find-unique-file.html 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; }