Checking a Registry Key Value

G

Guest

Doe anyone know how I can check if a key value in the registry is a specific
value. I would like to check that the "Display name" is "Microsoft Office
Standard Edition 2003"
for
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90120409-6000-11D3-8CFE-0150048383C9}
I know how to display it but I don't know how to check for this specific
value.. I believe Visio is installed with the same key and I want to
differentiate between the products for an office rollout project I am
working on. Thanks!
 
M

Mark V

In said:
Doe anyone know how I can check if a key value in the registry
is a specific value. I would like to check that the "Display
name" is "Microsoft Office Standard Edition 2003"
for
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9012040
9-6000-11D3-8CFE-0150048383C9} I know how to display it but I
don't know how to check for this specific value.. I believe
Visio is installed with the same key and I want to differentiate
between the products for an office rollout project I am working
on. Thanks!

Perhaps REG.EXE and FIND.EXE?

(using shorter example)

C:\>reg query "HKEY_CURRENT_USER\Console\CMD" /v "FaceName"
Errorlevel will be 0 if valuename found. 1 otherwise.

Next step (where the FaceName = "Terminal")

C:\>reg query "HKEY_CURRENT_USER\Console\CMD" /v "FaceName" | FIND.EXE "FaceName"
FaceName REG_SZ Terminal

C:\>echo %errorlevel%
0


C:\>reg query "HKEY_CURRENT_USER\Console\CMD" /v "FaceName" | FIND.EXE "FaceZZZZ"

C:\>echo %errorlevel%
1

IF %errorlevel% EQU 0 echo/ Found expected data.

There are of course other methods but this is simple and can be
run in a batch file.

REG.EXE is either shipped in the OS or in the Support Tools (W2K) or
Resource Kit. Recall that various MS applications install under
different "ID"s. "Microsoft Visio 2000" here for example stores it's
"DisplayName" under \{DBFA7530-0CBF-11D3-8CC0-00C04F72C04D}\
 
J

Jerold Schulman

Doe anyone know how I can check if a key value in the registry is a specific
value. I would like to check that the "Display name" is "Microsoft Office
Standard Edition 2003"
for
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90120409-6000-11D3-8CFE-0150048383C9}
I know how to display it but I don't know how to check for this specific
value.. I believe Visio is installed with the same key and I want to
differentiate between the products for an office rollout project I am
working on. Thanks!


In a batch, Using <B>REG.EXE</B>, built into Windows XP, Windows Server 2003, and later operating systems, or installed from the
Windows 2000 Support Tools:


set key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90120409-6000-11D3-8CFE-0150048383C9}
set DspName=Not Found
for /f "Tokens=2*" %%a in ('reg query %key% /V DisplayName^|Find "REG_SZ"') do (
set DspName=%%b
)
if /i "%DspName%" NEQ "Microsoft Office Standard Edition 2003" goto NotMSOSE2K3


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top