[英]how can I programmatically in .net backup or restore a regedit node?
There are several ways to do this.有几种方法可以做到这一点。 You can use regedit.exe to export it to a reg file for backup and use the file for restoring purpose.
您可以使用 regedit.exe 将其导出为 reg 文件进行备份,并使用该文件进行恢复。
Example to export subkeys to a reg file将子项导出到 reg 文件的示例
regedit.exe /e c:\temp\out.reg "HKEY_CURRENT_USER\Software\Microsoft\InputPersonalization"
Or use P/Invoke to call RegSaveKey and RegRestoreKey to do this或者使用 P/Invoke 调用 RegSaveKey 和 RegRestoreKey 来执行此操作
https://www.codeproject.com/Articles/7874/%2FArticles%2F7874%2FHow-to-Save-and-Restore-Registry-Keys https://www.codeproject.com/Articles/7874/%2FArticles%2F7874%2FHow-to-Save-and-Restore-Registry-Keys
Or use .Net Framework Microsoft.Win32.Registry to read and write values to a different file.或者使用 .Net Framework Microsoft.Win32.Registry 将值读取和写入不同的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.