如果在 64 位 Windows 上只有关键
HKLM\SOFTWARE\Wow6432Node\A.E.T Europe B.V.
但没有钥匙
HKLM\SOFTWARE\A.E.T Europe B.V.
结果不同的原因很可能reg.exe
是从批处理文件或命令行执行的版本引起的。
%SystemRoot%\System32\reg.exe
如果在处理批处理文件时执行 64 位或%SystemRoot%\System32\cmd.exe
在使用该行时以 64 位运行命令,则找不到密钥
reg query "\\I301\HKLM\SOFTWARE\A.E.T Europe B.V."
但是,如果在处理批处理文件时执行 32 位或在使用该行时%SystemRoot%\SysWOW64\reg.exe
通过 32 位运行命令,则会找到密钥%SystemRoot%\SysWOW64\cmd.exe
reg query "HKLM\SOFTWARE\A.E.T Europe B.V."
因为对于 32 位应用程序,注册表访问HKLM\SOFTWARE
是HKLM\SOFTWARE\Wow6432Node
由注册表重定向器重定向到的。
检查两个可能的关键位置:
@echo off
%SystemRoot%\System32\ping.exe -n 1 I301 >nul
if errorlevel 1 (
echo Computer with name I301 is not available in network.
goto :EOF
)
%SystemRoot%\System32\reg.exe query "\\I301\HKLM\SOFTWARE\A.E.T Europe B.V." >nul 2>&1
if not errorlevel 1 goto Installed
%SystemRoot%\System32\reg.exe query "\\I301\HKLM\SOFTWARE\Wow6432Node\A.E.T Europe B.V." >nul 2>&1
if not errorlevel 1 goto Installed
echo A.E.T Europe B.V. is not installed.
goto :EOF
:Installed
echo A.E.T Europe B.V. is installed already.
另请参阅 Microsoft 文档页面: