|
Answer» Hi all, this is my first post on this site, and I THANK any and all repliers!
I'm trying to create a simple batch file that will check for a certain version of software, and then run a PATCH if that version isn't there. I WANT to update Adobe READER from 9.1 to 9.1.1.
This is what I have so far:
ECHO OFF c: Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL IF %ERRORLEVEL% == 0 ( msiexec /update "\\server\share\AdbeRdrUpd911_all_incr.msp" /quiet ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date% >> \\server\logging\Adobe_Reader_9.1.1-update.txt )
It's not working and I know it's something basic. Try this: NOT TESTED
ECHO OFF c: Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL IF %ERRORLEVEL% == 0 ( msiexec /update "\\server\share\AdbeRdrUpd911_all_incr.msp" /quiet ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date% >> \\server\logging\Adobe_Reader_9.1.1-update.txt )
Lose the spaces! They are significant in an IF test where you use the == equality operator.
Code: [Select]IF %ERRORLEVEL%==0 or use EQU
Code: [Select]IF %ERRORLEVEL% EQU 0
Code: [Select]@ECHO OFF Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL IF ERRORLEVEL 1 ( msiexec /update "\\server\share\AdbeRdrUpd911_all_incr.msp" /quiet >>\\server\logging\Adobe_Reader_9.1.1-update.txt ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date% ) Thanks for all your help!
This WORKS:
@ECHO OFF Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL IF ERRORLEVEL 1 ( msiexec /update "\\server\share\Adobe Reader 9.1\AdbeRdrUpd911_all_incr.msp" /quiet ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date% >> \\server\share\Adobe_Reader_9.1.1-update.txt )
|