View Full Version : Checking registry for software version
I need to write some sort of program to read the registry and check which version of JRE exists, if it exists at all. I'm a little new at this and don't know where to start. Any suggestions will be appreciated.
Thanks.
Anonymous
07-14-1999, 10:39 PM
Have you tried to use Microsoft SMS Installer software, or kixstart scripting?
jstolz
07-16-1999, 03:26 AM
Well, if you know that this "JRE" software leaves a value equal to the version number, then you can do all of it in DOS. Use regedit at the command line as follows:
regedit /e c:\mydir\testfile.reg HKEY_CURRENT_USER\Software\JRE
This exports all of the values under HKEY_CURRENT_USER\Software\JRE to c:\mydir\testfile.reg. Note: If the registry key has any spaces in it, enclose the registry parameter in double quotes, as in "HKEY_CURRENT_USER\Software\JRE"
Now you have a text file that presumeably contains a string with the version number--maybe it's "Version=1.23". Use the FIND command to see if the version number is the one you want, as in:
find "Version=1.23" c:\mydir\testfile.reg
if you put the above find command in a batch file, you can test for errorlevels:
0 - at least 1 match was found
1 - no matches were found
2 - find did not complete so it doesn't know if a match is there
Obviously you can then perform the appropriate action based on what errorlevel is returned...
Who needs all that fancy software... good ole DOS!
Regards...
I was originally working with Windows 95 and tried using regedit /e etc... it worked great.
However, now I'm testing my batch file on Windows NT and I get an error saying that it can't find the testfile.reg. I also tried using regedt32 which is apparently the command for NT and that only opens the registry window instead of reading the registry key.
Any suggestions would be greatly appreciated!
Thanks.
jstolz
07-20-1999, 08:25 PM
Well, I'm afraid I know nothing about NT. About all I can suggest is what you've probably already done--verifying the NT command line parameters for regedit or regedit32...
Regards...
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.