There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
DOS/PDA/Other
Tag Cloud
backup bios boot bsod computer connection crash dell driver drivers email error excel firefox freeze hard disk hard drive hardware hijackthis internet kb977165 keyboard laptop linksys macro malware network outlook outlook 2003 outlook 2007 password problem recovery router server slow sound toshiba trojan usb video virus vista vpn windows windows 7 windows vista windows xp wireless youtube
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Solved: Script issue with displayname and version

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

 
Thread Tools
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
08-Feb-2010, 08:11 AM #1
Solved: Script issue with displayname and version
Ok so I am working on trying to figure out how to setup a script to show the version while hiding the everything but "Current version = "

I currently have

""""""
@echo off
REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{String here} /v DisplayName >nul 2>&1
If %errorlevel%==0 echo This program is installed.
If %errorlevel%==1 echo This program is not installed.

REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{String here} /v DisplayVersion
""""""

The second line is where I am having the issue. The registry line is the same for both versions of this software and I need to display only the version without showing the full command line.

Is there a way to show which version with an echo statement before and after??

Thank you.
Raven
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
08-Feb-2010, 08:17 AM #2
Additional info.

The two versions of the program share the same Registry string. Now I know the first setup will work with other programs that we look for an update regularly. But since this one program has the exact same registry string I need to be able to display by the version value which program is installed.

So in essence I am looking for the script to look at the versions and depending on the versions value being able to apply both an echo statement for that version as well as displaying just hte Version after or before the echo statement if possible.

I am stumped and my books are not showing me what I need.

Help please
Squashman's Avatar
Trusted Advisor with 15,875 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
08-Feb-2010, 09:11 AM #3
Not sure if this is what you are trying to do.

Code:
@echo off
REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{String here} /v DisplayName >nul 2>&1
If %errorlevel%==0 (
     echo This program is installed.
     REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{String here} /v DisplayVersion 
) ELSE (
     echo This program is not installed
)
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
08-Feb-2010, 09:37 AM #4
Not quite..

I guess what I am looking for it a command line that will search the version value and based on that value provide an echo statement for each version of the program that will show.

So in theory if the value of the Version is 4.21.4.0 is will display on my command window
- Program A version "version value" is installed.
- Program B version "version value" is installed.

So if I have version 4.21.1 it will say BC09 version 4.2 is installed
or
if I have version 4.11.2 it will say QR1 version 4.11 is installed.

since they share the same registry string it is not easy to seperate. At least I am not finding a way.
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
08-Feb-2010, 09:40 AM #5
Maybe something along the line of an

if DisplayVersion = 4.22.0.1 echo "BC09 version 4.22 is installed"
if displayversion = 4.11.0.1 echo "QR1 version 4.11 is installed"

hopefully that makes more sense.
TheOutcaste's Avatar
Computer Specs
Trusted Advisor with 6,932 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
08-Feb-2010, 09:54 AM #6
Code:
For /F "Tokens=3 skip=2" %%I In ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{string here}" /V DisplayVersion') Do Echo Version %%I is installed
Would need to see the output of the specific Reg Query command to see if something different is needed
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
08-Feb-2010, 10:08 AM #7
REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0000C40F-A401-4C9C-AF3E-0382E92E1E22} /v DisplayVersion

Is the actualy string but the displayed info is

HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0000C40F-A401-4C9C-AF3E-0382E92E1E22}
DisplayVersion REG_SZ 4.21.4.044
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
08-Feb-2010, 10:16 AM #8
Ok so it came back with

Token=3 skip=2" was unexpected at this time.
Squashman's Avatar
Trusted Advisor with 15,875 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
08-Feb-2010, 10:27 AM #9
Tokens. Plural.

Lets see all your code.
TheOutcaste's Avatar
Computer Specs
Trusted Advisor with 6,932 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
08-Feb-2010, 10:36 AM #10
That should work then. Wasn't sure if there were spaces in the version number. Just for future reference, if there are spaces in the data, use this format instead:
Code:
For /F "Tokens=2* skip=2" %%I In ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{string here}" /V DisplayVersion') Do Echo Version %%J is installed
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
09-Feb-2010, 06:13 AM #11
Ok so this seems to still not work.

Under the
"HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0000C40F-A401-4C9C-AF3E-0382E92E1E22}"

I need to be able to find the REG_SZ value and based on that value create a display echo showing

"Program version "value of REG_SZ" is installed.

The two values I am looking for are 4.22.1.044 and 4.11.2.044

The above strings listed so far seem to come back with errors and I can't seem to find the disconnect.
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
09-Feb-2010, 06:26 AM #12
@echo off
@if not "%OS%"=="Window_NT" goto :EXIT
@if "%1"==" " (set INFO=echo && set SEXIT=1) else (set INFO=rem && set SEXIT=0)

%INFO% This script is to query all installed programs to verify by version that the systems are up to date.

@title "Configuration Check Starting.."

%INFO% == Program A Version Check ==

For /F "Token2* skip=2" %%I In ('REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0000C40F-A401-4C9C-AF3E-0382E92E1E22} /v DisplayVersion') Do echo Program A Version %%J is installed.

echo .
echo .

%INFO% == Adobe Version Check ==

REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A93000000001} /v DisplayName >nul 2>&1
If %errorlevel%==0 echo == Adobe Reader ver 9.3 is installed.

REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A92000000001} /v DisplayName >nul 2>&1
If %errorlevel%==0 echo == Adobe Reader ver 9.2 is installed.

REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A91000000001} /v DisplayName >nul 2>&1
If %errorlevel%==0 echo == Adobe Reader ver 9.1 is installed.

REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1033-7B44-A80000000002} /v DisplayName >nul 2>&1
If %errorlevel%==0 echo == Adobe Reader ver 8.0.2 is installed.



This is so far what I have but I am also going to add more to it once I fix the main issue of deciphering by DisplayVersion value which version of the software is installed.
TheOutcaste's Avatar
Computer Specs
Trusted Advisor with 6,932 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
09-Feb-2010, 06:29 AM #13
Quote:
Originally Posted by raven6988 View Post
For /F "Token2* skip=2" %%I In ('REG Query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{0000C40F-A401-4C9C-AF3E-0382E92E1E22} /v DisplayVersion') Do echo Program A Version %%J is installed.
That should be Tokens=2*
raven6988's Avatar
Junior Member with 21 posts.
 
Join Date: Feb 2010
Experience: Intermediate
09-Feb-2010, 06:43 AM #14
Opps.. didn't even see that 's'

One last question.

How can I do an If statement based on that version to echo a specific line?
Squashman's Avatar
Trusted Advisor with 15,875 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: IIAHYAYCESA,YAADA!
09-Feb-2010, 06:49 AM #15
Quote:
Originally Posted by Squashman View Post
Tokens. Plural.
Quote:
Originally Posted by raven6988 View Post
Opps.. didn't even see that 's'
And you missed the equals sign.

Quote:
Originally Posted by raven6988 View Post
One last question.

How can I do an If statement based on that version to echo a specific line?
Instead of echoing %%J just do an If statement.

IF %%J==%somevar% .....
Reply Bookmark and Share   techguy.org/901237

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 12:19 AM.
Copyright © 1996 - 2010 TechGuy, Inc. All rights reserved.
Powered by Cermak Technologies, Inc.