所以我使用此代码添加Key registry 以在启动时自动打开我的应用程序:
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
Assembly curAssembly = Assembly.GetExecutingAssembly();
key.SetValue(curAssembly.GetName().Name, curAssembly.Location);
Run Code Online (Sandbox Code Playgroud)
所以现在我希望能够删除此选项,以便将其添加到应用程序用户定义中,以便我搜索RemoveKey类似的内容。
有什么建议 ?
使用DeleteValue()方法:
key.DeleteValue(curAssembly.GetName().Name);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
592 次 |
| 最近记录: |