A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

[C#.net] Auto Run via Registry

2.4k views · started by Chad ·
#1
[C#.net] Auto Run via Registry
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 code to delete the value to get it out of the registry.


using Microsoft.Win32;

RegistryKey regDel = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
regDel.DeleteValue("Testing");
regDel.Close();


You can change the "Testing" to make it your own key name. Simple and easy.
#2
Auto-run? As in, run at startup?
#3
GAMEchief wrote:
Auto-run? As in, run at startup?


Yes. Thought people would know what Auto run is.
#4
Thanks ;D can make even more epic viruses now >.< didnt know how to auto run at startup.