WPF - 删除启动后自动运行的应用程序



所以我使用此代码添加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);

所以现在我希望能够删除此选项,以便将其添加到 m 应用程序用户定义中,所以我在类似的东西上搜索RemoveKey

有什么建议吗?

使用 DeleteValue(( 方法:

key.DeleteValue(curAssembly.GetName().Name);

相关内容

最新更新