Is there a managed API for kernel32.searchpath? i.e not using a pinvoke.
Is there a managed API for kernel32.searchpath?
974 Views Asked by Simon At
3
There are 3 best solutions below
1

You can use DirectoryInfo.GetFiles(String searchPattern, SearchOption searchOption). To get all of the *.exe files in a directory including subdirectories, you could use:
DirectoryInfo di = new DirectoryInfo("c:\temp");
var files = di.GetFiles("*.exe", SearchOption.AllDirectories);
Take a look at the MSDN documentation at http://msdn.microsoft.com/en-us/library/ms143327.aspx