2011-02-02 5 views
0

이것은 작동합니다.시작 프로그램을 나열하는 방법

소프트웨어 \ 마이크로 소프트 \ 윈도우 \ CurrentVersion \ 실행

 RegistryKey HKCU = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run"); 
     foreach (string Programs in HKCU.GetValueNames()) 
     { 
      string GetValue = HKCU.GetValue(Programs).ToString(); 
      Console.WriteLine(getFilePath(GetValue)); //Environment.NewLine 
     } 
     HKCU.Close(); 

이없는 모든 시작 프로그램.

HKLM \ SOFTWARE \ 마이크로 소프트 \ 윈도우에서 모든 시작 프로그램 \ CurrentVersion을이 정책 \ Explorer를 \ 실행 \

RegistryKey key = Registry.LocalMachine.OpenSubKey("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run"); 
      foreach (string Programs in key.GetValueNames()) 
      { 
       string GetValue = key.GetValue(Programs).ToString(); 
       Console.WriteLine(getFilePath(GetValue)); 
      } 

있습니다; 나는 관리자 권한을 가지고 있고, 32 비트 OS를 가지고 있으며 또한 내 앱 설정이다.

+0

당신이지고있어 오류가 무엇입니까? – Shimrod

+2

귀하의 질문은 무엇입니까? – Lazarus

+0

두 번째 함수는 시작 프로그램을 나열하지 않습니다. "HKLM \\ Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Policies \\ Explorer \\ Run" –

답변

0

그것은

RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run"); 

하지

RegistryKey key = Registry.LocalMachine.OpenSubKey("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run"); 

HKLM 이미 "Registry.LocalMachine"로 선택되어야한다.

하지만 내 창 7에는이 키가 없습니다.

+1

예, 실제로이 입력 오류입니다. 그것은 RegistryKey key = Registry.LocalMachine.OpenSubKey ("Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Policies \\ Explorer \\ Run") 여야합니다. –

+0

좋아, 그럼 내가 말한 모든 것을 잊어 버리라 :-) – SpeziFish

0

바로 다음 사용 ...

RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run"); 

또는

RegistryKey keyy1 = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run"); 
관련 문제