0

I want to scan and get all the Application files in my computer.
I know how to get them, but I want only the applications which are Executable (except for Installers).

Basically, what I want is the same function steam uses. Example: enter image description here

Ron
  • 3,975
  • 17
  • 80
  • 130

2 Answers2

3

You can use this code to find all exes recursively in a directory

    DirectoryInfo dirInfo = new DirectoryInfo(@"C:\Program Files");
    var exeFiles = dirInfo.EnumerateFiles("*.exe", SearchOption.AllDirectories);

    foreach ( var exeFile in exeFiles )
    {
        Console.WriteLine( exeFile );
    }

Depending on you definition of executable you might have to also do *.com , *.bat etc etc. There is no way to distinguish between an installer exe vs regular exe file though. You might have to apply some heuristics

parapura rajkumar
  • 24,045
  • 1
  • 55
  • 85
  • As I said, I know how to scan the apps. I dont know how to decide if it's installer or not.. anyway I dont think that's the way Steam uses. – Ron Jan 23 '12 at 15:51
2

If you want to get the list of installed applications on your system, you can query the registry. Refer to Get installed applications in a system for an example.

Community
  • 1
  • 1
Douglas
  • 53,759
  • 13
  • 140
  • 188
  • I know how to get the installed applications. I am pretty sure Steam uses this solution combined with some filters and more function, but I cant find out how they do it exactly... – Ron Jan 23 '12 at 15:52