views:

23

answers:

1
string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
        using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(registryKey))
        {
            (from a in key.GetSubKeyNames()
             let r = key.OpenSubKey(a)
             select new
             {
                 Application = r.GetValue("DisplayName")
             }).ToList().FindAll(c => c.Application != null).ForEach(c => Debug.WriteLine(c.Application));

This snippet displays all the names of the application in the registry. I need the paths to the exe files that execute the application and I need to know how to run them using Process.Start();

+1  A: 

There isn't really a definitive source for this anywhere in Windows. The closest you'll get is by enumerating the start menu. View this post for how to do that: http://stackoverflow.com/questions/2329647/programmatically-access-all-users-start-menu

Basically, you need to call the SHGetSpecialFolderPath API to retrieve the location of the start menu and then enumerate all of the shortcuts in that path.

This stackoverflow question talks about how to extract the icon from a shortcut; you can use the same method to extract the working path and executable which you would need to launch the application: http://stackoverflow.com/questions/343200/extract-icon-from-windows-lnk-shortcut-file

Jesse Weigert