所以我使用这段代码添加 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);
所以现在我希望能够删除此选项,以便将其添加到我的应用程序用户定义中,因此我在类似的内容上搜索 RemoveKey
。
有什么建议吗?
最佳答案
使用 DeleteValue()方法:
key.DeleteValue(curAssembly.GetName().Name);
关于c# - WPF - 删除启动后自动运行的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49382278/