Windows 7注册表:如何按程序计划(批处理)编辑注册表项?

时间:2011-09-08 15:01:33

标签: windows batch-file registry key

例如。当特定的注册表项值变为39时,我必须将其重置为0.批处理是否可行?或者我可以使用什么应用程序(语言),以及如何使用?你能让我看一个例子吗?感谢

1 个答案:

答案 0 :(得分:1)

如果您是c#开发人员,请查看此帖子。它演示了如何使用WMI监视注册表值。然后,您可以检查返回值,如果> = 39将其设置为0。

Registry Watcher C#

来自Registry Watcher C#的Eample片段。在此处添加注册表值更改事件代码

   private void HandleEvent(object sender, EventArrivedEventArgs e) 
    { 
      RegistryKey myKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\My Registry Key", true);
       myKey.SetValue("My Value", "0", RegistryValueKind.String);
    }