Jump to content

How to check if an application is installed?


motherfok

Recommended Posts

I figured a good way to install an application on multiple machines, is to put instructions for it in the login script that these machines use. However, this way the application will be installed every time the user logs on. What are some good ways of detecting if the application has been installed yet? (and if so: skip the installation)

Perhaps checking for specific registry entries, or files that are unique to that version of a certain application.... Anything else? How would you do it? (code please ;))

Edited by motherfok
Link to comment
Share on other sites


I'd keep it simple. Check for the executable in the lcoation that you're intalling it to. If it's there, skip the install, if not install it.

That's the simple way.

Actually it's an update to an application. Executable names of both versions are the same.. :blushing:

Link to comment
Share on other sites

You could use REG.exe to check a specific registry entry. Type REG QUERY at the command prompt for further syntax information. You could pipe the results into a FIND command to verify installation. You could also check the %errorlevel% system variable immediately after the REG QUERY in order to verify installation.

If there are no appropriate registry entries to be checked, a last resort is to use FILEVER.exe to determine the version of the executable.

- Ravashaak

Link to comment
Share on other sites

I use the following batch files to install and update applications

on both Window Me clients and Windows XP clients

in windows 2000 server network environment.

My method is based on computer name of each clients

rather checking the version of the applications.

logon.bat

net use I: \\server1\f1

net use J: \\server1\f2

net use F: \\server2

net time \\server1 /set /yes

if (%OS%) == (Windows_NT) goto XP

if exist F:\PROUP\SU.BAT start R:\PROUP\SU.BAT

goto end

:XP

if exist F:\PROUP\SU.BAT call R:\PROUP\SU.BAT

:end

exit

post-63953-1131021322_thumb.jpg

SU.BAT

set drive=R:

%drive%

cd %drive%\proup

if not exist c:\cname.bat start /wait ComputerName.vbs

call c:\cname.bat

set dir=SU1

if not exist %dir%\%cn% goto next1

if exist %dir%\%cn%.done goto next1

cd %dir%

for %%U in (*.bat) do call %%U

echo %cn% > %cn%.done

cd ..

:next1

set dir=SU2

if not exist %dir%\%cn% goto next2

if exist %dir%\%cn%.done goto next2

cd %dir%

for %%U in (*.bat) do call %%U

echo %cn% > %cn%.done

cd ..

:next2

:end

cls

@exit

post-63953-1131021529_thumb.jpg

ComputerName.vbs

Set objShell = Wscript.CreateObject("Wscript.Shell")

Set colSystemEnvVars = objShell.Environment("System")

Set colUserEnvVars = objShell.Environment("User")

Set objNetwork = Wscript.CreateObject("Wscript.Network")

UName = objNetwork.UserName

CName = objNetwork.ComputerName

Set WShell = CreateObject("WScript.Shell")

Call WShell.Run ("command /c echo set cn=" & cname & "> c:\cname.bat",,True)

WScript.DisconnectObject(WShell)

Wscript.Quit

UP.BAT

if (%OS%) == (Windows_NT) goto XP

:ME

if exist "C:\Program Files\7-Zip\Uninstall.exe" start /wait "C:\Program Files\7-Zip\Uninstall.exe" /S

ping locahost > NUL

goto end

:XP

if exist "%ProgramFiles%\7-Zip\Uninstall.exe" start /wait "aa" "%ProgramFiles%\7-Zip\Uninstall.exe" /S

ping locahost > NUL

:end

start /wait Seven-Zip\7z429.exe /S

regedit /s Seven-Zip\7-Zip.reg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...