다음은 모든 사용자를 위해 설치된 앱을 제공합니다. 뿐만 아니라 Registry.CurrentUser에 대해 동일한 작업을 수행 :
RegistryKey uninstall = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
List<string> applicationList = new List<string>();
foreach (string subKeyName in uninstall.GetSubKeyNames())
{
RegistryKey subKey = uninstall.OpenSubKey(subKeyName);
string applicationName = subKey.GetValue("DisplayName", String.Empty).ToString();
if (!String.IsNullOrEmpty(applicationName))
{
applicationList.Add(applicationName);
}
subKey.Close();
}
uninstall.Close();
applicationList.Sort();
foreach (string name in applicationList)
{
Console.WriteLine(name);
}
부인을 내 샘플 검사에는 null 값/오류가 없습니다!
물론 이것은 레지스트리에 나열된 응용 프로그램 목록 만 반환합니다. XCOPY 배포를 통해 배포 된 응용 프로그램은 표시되지 않습니다. – pmarflee
그래, 잠재적으로 아담의 모든 앱이 레지스트리에 나타나지는 않을 것이다. 앱이 설치되지 않고 디스크에 복사 된 앱일 수 있기 때문이다. –
감사합니다. StackOverflow 규칙! –