Hi there,
I've never used a batch file to query a registry entry, So I believe my problem is there!
What I am trying to do is:
1 Look for a registry setting, if found, move to 5, if not, move on
2 Look for another registry setting, if found, move to 6, if not, move on
3 Look for another registry setting, if NOT found, move to 7, if not, move on to 8
4 Look for another registry setting, if found, move to 9
5 run specific uninstaller, when finished, go to 8
6 run specific uninstaller, when finished, go to 8
7 Install specific version of software, go to 8
8 Restart machine
9 Exit
This will be run from the startup folder and will cycle till complete, then delete itself.
Here is the code
@ECHO OFF
IF EXIST REG QUERY HKLM\Software\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc /v ProgramVer /t REG_SZ /d 5.58 GOTO ONE ELSE
IF EXIST REG QUERY HKLM\Software\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc /v ProgramVer /t REG_SZ /d 8.0 GOTO TWO ELSE
IF NOT EXIST REG QUERY HKLM\Software\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc /v ProgramVer /t REG_SZ /d 10.0 GOTO THREE
IF EXIST REG QUERY HKLM\Software\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc /v ProgramVer /t REG_SZ /d 10.0 GOTO FIVE ELSE
:ONE
START /WAIT ".\5.53\CmnUnins.exe"
GOTO FOUR
:TWO
START /WAIT ".\8.0\CmnUnins.exe"
GOTO FOUR
:THREE
START /WAIT ".\10.0\msiexec /a /forcerestart Osce10.msi"
EXIT
:FOUR
START C:\Windows\RUNDLL.EXE user.exe,exitwindowsexec
EXIT
:FIVE
; Need to add in a DEL command for the file in the Startup menu
EXIT
To Test the process, I Changed the first part to:
IF NOT EXIST REG QUERY HKLM\Software\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc /v ProgramVer /t REG_SZ /d 5.58 GOTO ONE ELSE
and
:ONE
ECHO IT WORKS
PAUSE EXIT
But it gives me an error
Invalid Parameter(s)
QUERY { PROCESS | SESSION | TERMSERVER | USER }
Invalid Parameter(s)
QUERY { PROCESS | SESSION | TERMSERVER | USER }
Is this to do with an incorrect Reg Query? or is it to do with my user rights (Admin)?
Anyone able to help?
(If I post this on any other forums, I will place links here!)
Bird