总结一下我想要实现的目标,我想查询2个密钥,如果它们存在则转到批处理文件的末尾,如果没有安装Java。
批处理文件正在安装Java,但在测试时是否删除了.txt文件:
IF exist %windir%\gpologs\jre_1.7.21.x86.txt goto eof ELSE goto Q1
即使存在其中一个注册表项,安装程序仍尝试安装在顶部?
这是完整的批处理文件:
IF exist %windir%\grouppolicylogs\jre_1.7.21.x86.txt goto eof ELSE goto Q1
:Q1
Reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F86417025FF}"
if %ErrorLevel% EQU == 0 goto End ELSE goto Q2
:Q2
Reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83217021FF}"
if %ErrorLevel% EQU == 0 goto End ELSE goto Install
:Install
msiexec /i "\\servername\SoftwareRep\Java\Java 1.7.0_21 x86\jre1.7.0_21.msi" /qn
if %ErrorLevel% EQU 0 (
>>"\\servername\gpolog\jre_1.7.21.x86.csv" echo "%computername%","%date%","%Time%","%ErrorLevel%","Java Runtime 1.7.0_21x86 Installed"
>>"%windir%\GpoLogs\jre_1.7.21.x86.txt" echo "Java Runtime 1.7.0_21x86 Installed"
) else (
>>"\\servername\gpolog\JavaInstallErrors.csv" echo "%computername%","%date%","%Time%","%ErrorLevel%","Error trying to install Java 1.7_21x86"
)
:END
我哪里错了?
答案 0 :(得分:1)