如何搜索包含特定字符串的所有注册表项. [英] how to search all registry keys containing a specific string..

查看:271
本文介绍了如何搜索包含特定字符串的所有注册表项.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在设计一个实用程序,在其中我需要删除所有包含HKEY_LOCAL_MACHINE \ SOFTWARE \
中的特定单词的注册表项值
但是我没有任何想法,那我怎么找到No.我有时需要遍历树..

请帮忙.

Hi all,

I am designing an utility in which I need to delete all the registry key values containing a specific word in HKEY_LOCAL_MACHINE\SOFTWARE\

But I am not having any idea, that, how do i find the no. of times do i need to iterate through the tree..

please help.

推荐答案

一点点的os搜索显示了解决问题的一种好方法.您可以直接转到页面 ...

tlbimp "C:\Program Files\Log Parser 2.2\LogParser.dll"
/out:Interop.MSUtil.dll



下面是一个小示例,它显示了如何在\ HKLM \ SOFTWARE树中查询值"MyValue".



Below is a small sample, that shows how to query for the Value ''MyValue'' in the \HKLM\SOFTWARE tree.

using System;
using System.Runtime.InteropServices;
using LogQuery = Interop.MSUtil.LogQueryClass;
using RegistryInputFormat = Interop.MSUtil.COMRegistryInputContextClass;
using RegRecordSet = Interop.MSUtil.ILogRecordset;

class Program
{
  public static void Main()
  {
    RegRecordSet rs = null;
    try
    {
      LogQuery qry = new LogQuery();
      RegistryInputFormat registryFormat = new RegistryInputFormat();
      string query = @"SELECT Path from \HKLM\SOFTWARE\Microsoft where
      Value=''VisualStudio''";
      rs = qry.Execute(query, registryFormat);
      for(; !rs.atEnd(); rs.moveNext())
        Console.WriteLine(rs.getRecord().toNativeString(","));
    }
    finally
    {
      rs.close();
    }
  }
}




第二种方法就像您已经说过的那样,它需要遍历整个树以获取值..您可以使用下面链接中提供的示例

http://howtoideas.net/how-to-perform-searching-in- Registry-keys-using-c [ ^ ]




Second way is as you have already said that it needs to iterate the whole tree for getting values..You can use the example provide in below link

http://howtoideas.net/how-to-perform-searching-in-registry-keys-using-c[^]


这篇关于如何搜索包含特定字符串的所有注册表项.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆