You can change the code to delete the value to get it out of the registry.Code:using Microsoft.Win32; RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); if (regKey.GetValue("Testing") == null) { regKey.SetValue("Testing", Application.ExecutablePath.ToString()); }
You can change the "Testing" to make it your own key name. Simple and easy.Code:using Microsoft.Win32; RegistryKey regDel = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); regDel.DeleteValue("Testing"); regDel.Close();
Results 1 to 4 of 4
Thread: [C#.net] Auto Run via Registry
- 07 Mar. 2010 11:34am #1
[C#.net] Auto Run via Registry
- 07 Mar. 2010 06:28pm #2
Auto-run? As in, run at startup?
- 07 Mar. 2010 08:47pm #3
- 08 Mar. 2010 12:42pm #4