2011-02-02 18 views
0

これが動作します。スタートアッププログラムを一覧表示する方法

SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Runを

 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 \ Microsoft \ Windowsの\ CurrentVersionの\ポリシー内のすべてのスタートアッププログラムは

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

2番目の機能にはスタートアッププログラムが表示されません。 "HKLM \\ソフトウェア\\マイクロソフト\\ Windows \\ CurrentVersion \\ポリシー\\エクスプローラ\\実行"の位置を見つけることができません –

答えて

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

はい、それは実際にこの例の入力エラーでした。それはレジストリキーでなければならないkey = Registry.LocalMachine.OpenSubKey( "ソフトウェア\\マイクロソフト\\ Windows \\ CurrentVersion \\ポリシー\\エクスプローラ\\実行"); –

+0

よろしくお願いします。 – SpeziFish

0

だけで、次の使用...

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

または

RegistryKey keyy1 = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run"); 
関連する問題