Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

check program installed c#

public static bool checkInstalled (string c_name)
{
    string displayName;

    string registryKey = @"SOFTWAREMicrosoftWindowsCurrentVersionUninstall";
    RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey);
    if (key != null)
    {
        foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName)))
        {
            displayName = subkey.GetValue("DisplayName") as string;
            if (displayName != null && displayName.Contains(c_name))
            {
                return true;
            }
        }
        key.Close();
    }

    registryKey = @"SOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall";
    key = Registry.LocalMachine.OpenSubKey(registryKey);
    if (key != null)
    {
        foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName)))
        {
            displayName = subkey.GetValue("DisplayName") as string;
            if (displayName != null && displayName.Contains(c_name))
            {
                return true;
            }
        }
        key.Close();
    }
    return false;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #program #installed
ADD COMMENT
Topic
Name
7+2 =