简体   繁体   English

通过批处理文件从注册表中获取值并与其他子文件夹进行比较该值是否存在并进行导出

[英]Get value from registry via batch file and do comparison with other sub folder whether this value exist and do the exporting

Appreciate if anyone could give some advises on how to retrieve a value from registry to do comparison with a list of subfolder.感谢是否有人可以就如何从注册表中检索值以与子文件夹列表进行比较提供一些建议。 Example as below:示例如下:

Path in registry:注册表中的路径:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon

From above path, it have 3 column with values:从上面的路径,它有 3 列的值:

Column [Name] : value [LastUsedUsername]
Column [Type] : value [REG_SZ]
Column [Data] : value [Administrador]

I want to get the value Administrador from column Data .我想从列Data获取值Administrador Then with this value I need to compare with a list of subfolder, if this value exist in other subfolder, then it will export file in sub folder.然后用这个值我需要与一个子文件夹列表进行比较,如果这个值存在于其他子文件夹中,那么它将导出子文件夹中的文件。

According to your provided information, the following will save the value data from your column to a variable:根据您提供的信息,以下内容会将列中的值数据保存到变量中:

@Set "VarName="
@For /F "EOL=HTokens=2*" %%G In ('^""%__AppDir__%reg.exe" Query ^
 "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" ^
 /V "LastUsedUsername" 2^>NUL^"')Do @Set "VarName=%%H"
@If Not Defined VarName GoTo :EOF

Your code would continue on the very next line, where %VarName% would be used for your comparison.您的代码将在下一行继续,其中%VarName%将用于您的比较。 I am unable to provide that for you at this time, because:我目前无法为您提供,因为:

  1. This is not a free code writing service .这不是免费的代码编写服务
  2. You have not provided sufficient details for someone to do that for you.你没有提供足够的细节让别人为你做这件事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM