I have this code that put an empty string in Autorun. I need to delete this Autorun.
How can I do it?
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnDisconnect", "AutoRun", "");
I have this code that put an empty string in Autorun. I need to delete this Autorun.
How can I do it?
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnDisconnect", "AutoRun", "");
You probably want some more defensive coding in case the key/values don't exist (or the user doesn't have permissions to delete it), but the basics are:
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows CE Services\AutoStartOnDisconnect", true);
key.DeleteValue("AutoRun", true);