3

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", "");
1
  • Although I have answered the question, this question is a duplicate of stackoverflow.com/questions/531151/… , which includes a more full answer than I have given here. Commented Jan 31, 2010 at 7:28

1 Answer 1

2

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.