How to check for installed softwares in a system

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
krisamigo
Posts: 3
Joined: 01 Feb 2010 07:56

How to check for installed softwares in a system

#1 Post by krisamigo » 01 Feb 2010 23:19

How to Create a batch file for checking the
1. Sql server express is installed or not
2. Dot net frame work 3.5 is installed or not
3. J# redistributable package is installed or not


Thanks in advance,

Regards
:)

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to check for installed softwares in a system

#2 Post by aGerman » 02 Feb 2010 14:15

krisamigo

There are different approaches.
If it is a registered software you could have a look to your registry (HKEY_LOCAL_MACHINE\SOFTWARE) to figure out if a software is installed. See also http://www.dostips.com/DtCodeCmdLib.php#Function.IsRegKey.
Otherwise you could look for a special exe file or folder. E.g.

Code: Select all

@echo off &setlocal
set "dotNETpath=%SystemRoot%\Microsoft.NET\Framework\v3.5"

if exist "%dotNETpath%" (
  echo Dot net frame work 3.5 is installed.
) else (
  echo Dot net frame work 3.5 not found.
)

pause


Regards
aGerman

krisamigo
Posts: 3
Joined: 01 Feb 2010 07:56

Re: How to check for installed softwares in a system

#3 Post by krisamigo » 02 Feb 2010 22:48

Hi aGerman

Thanks a ton for your reply
I want to check with registry values
if you dont mind can you assist me how to check with regiestry as i am not understood with the URL which is given

Awaiting for your reply.

Thanks
:)

sxekjb
Posts: 16
Joined: 07 Nov 2009 19:13

Re: How to check for installed softwares in a system

#4 Post by sxekjb » 03 Feb 2010 06:46

I've had most success querying for installed software by going through hklm\software\microsoft\windows\currentversion\uninstall
This has a list of installed software and keys that give info on the displayname,version, install location etc.

try using the reg command and output the results. IE

Code: Select all

REG QUERY \\machine\hklm\software\microsoft\windows\currentversion\uninstall >>output.log

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to check for installed softwares in a system

#5 Post by aGerman » 03 Feb 2010 07:39

krisamigo

sxekjb is right, this is also a possible solution.
The first you have to do is allways searching for a meaningful key in the registry. Use any registry editor (e.g. regedit.exe).

If you want to use the function of my url:

Code: Select all

@echo off &setlocal

call :IsRegKey "HKLM\SOFTWARE\Adobe\Acrobat Reader" &&(
  echo Acrobat Reader is intalled.
)||(
  echo Acrobat Reader is Not intalled.
)

pause
goto :eof

::~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:IsRegKey Key -- succeeds if Key exists
::            -- Key  [in]  - registry key
:$created 20060101 :$changed 20080219 :$categories Registry
:$source http://www.dostips.com
reg query "%~1">NUL 2>NUL
EXIT /b

The return of the function is something like TRUE or FALSE (errorlevel is 0 or greater than 0).
This example is for "Acrobat Reader". Of couse you have to replace and append the function calls with your keys.

Regards
aGerman

krisamigo
Posts: 3
Joined: 01 Feb 2010 07:56

Re: How to check for installed softwares in a system

#6 Post by krisamigo » 03 Feb 2010 23:26

Hi aGerman

Marvelous
Thanks a ton
i am breaking my head to use Req Query command with your suggestion it serves my requirement

Thanks once again

Besk of luck

Regards
:)

Post Reply