批处理文件查询注册在64位Vista [英] Batch File Querying Registry in 64-Bit Vista

查看:156
本文介绍了批处理文件查询注册在64位Vista的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

家伙我再嗨:)我有一个批处理文件,我写了一个问题。它工作正常,在32位,但显然它不会在64位系统的工作,我不知道为什么,因为我没有访问到64位系统。

Hi guys me again :) I have a problem with a batch file I wrote. It works fine on 32-bit, but apparently it doesn't work on 64-bit systems, and I don't know why because I do not have access to a 64-bit system.

这是在code对Vista 32位系统,该系统的工作原理

This is the code that works on Vista 32-bit system

    @echo off
Set Reg.Key=HKLM\SOFTWARE\Malwarebytes' Anti-Malware
  Set Reg.Val=InstallPath
  For /F "Tokens=2*" %%A In (
   'Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"'
  ) Do Call Set MBAMPATH=%%B

有人可以重新写在64位的工作吗?

Can someone re-write it to work on a 64-bit please?

感谢总是:)

推荐答案

有基于Windows的x86和x64版本的批处理文件没有任何区别。你的问题是由于了WoW64,透明的注册表重定向,请参阅这里了解更多详情。

There's no difference between batch files on x86 and x64 versions of Windows. The problem you have is due to WoW64 and transparent Registry redirection, see here for more details.

HKLM \ SOFTWARE \ Wow6432Node 是32位软件在64位Windows安装的正确的注册表项,而这code工作在我的机器上:

HKLM\SOFTWARE\Wow6432Node is the correct registry key for 32bit software on a 64bit installation of Windows, and this code works on my machine:

Set Reg.Key=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Malwarebytes' Anti-Malware
Set Reg.Val=InstallPath
For /F "Tokens=2*" %%A In (
    'Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"' )
Do Call Set MBAMPATH=%%B
echo %mbampath%

您的其他职位包括基于%PROCESSOR_ARCHITECTURE%环境变量条件分支。这问题是,(我的机器上至少)%PROCESSOR_ARCHITECTURE%AMD64不是64

Your other post includes a conditional branch based on the %processor_architecture% environment variable. The problem with that is that (on my machine at least) %processor_architecture% is "AMD64" not "x64".

为什么不只是查询两种可能的注册表项,而不是基于架构的分支?

Why not just query both possible registry keys rather than branching based on architecture?

这篇关于批处理文件查询注册在64位Vista的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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