WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Check if Application is Installed


Question:

Is there anyway to write a WB Code that will tell if a certain application has been installed on a system? I just need something that says basically, Yes this particular application has been installed, then it goes to the next application and verifies that one...

Answer:

Give this code a try:
installed = 0
progid = 'Word.Application' ; programmatic identifier of application
appname = 'Word'

; Check the registry ( 2 places )
;    Uninstall section
key = RegOpenKey( @REGMACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall' )
list = RegQueryKeys( key )
RegCloseKey( key )
If ItemLocate( StrLower( appname ), StrLower( list ), @TAB ) Then installed = 1
;    Prog ID
targetkey = RegExistKey( @REGCLASSES, progid )
If targetkey Then installed = 1

; Check for abilty to create a reference to a COM object.
ErrorMode( @OFF )
object = ObjectCreate( progid )
ErrorMode( @CANCEL )
If object
   installed = 1
   object = 0 ; Close object
EndIf

Pause( 'Word Install Checker', installed )
Exit

Article ID:   W15959
File Created: 2010:01:08:10:43:48
Last Updated: 2010:01:08:10:43:48