This question already has an answer here:
I'm trying to open installed softwares with their names
I use this codes below to open them but it doesn't detect all installed softwares.
Process proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = progName;
proc.Start();
Is there any way detect and open all of them with their names?
progName
is a string that changes with input.
You can try with this method:
using Microsoft.Win32;
public List<string> GetAllInstalledPrograms()
{
List<string> res = new List<string>();
string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
{
foreach (string subkey_name in key.GetSubKeyNames())
{
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
{
res.Add(subkey.GetValue("DisplayName").ToString());
}
}
}
return res;
}
progName
? What exactly are you trying to do? - sab669Process.Start("notepad++.exe", someFilePath);
only because n++ offers that functionality. If you write a custom win forms application which allows dragging and dropping of text files into a textbox for display,Process.Start("myApplication.exe", someFilePath);
won't do much of anything. - sab669