RossWindows
Que?
- Local time
- Today, 14:06
- Joined
- Feb 25, 2008
- Messages
- 410
Is there any way to program a batch file to check the version of Microsoft Access installed on a PC?
@ ECHO OFF
CLS
ECHO.
ECHO Starting the PIR Database. This should only take a few seconds.
ECHO.
REM Note that the variables and the batch file name MUST be customised for each database
REM ***** THE VARIABLES ******
REM PGRM is the variable for the file name of your current Front_End.mdb.
REM When updating the version of the Front End simply change PGRM and resave the batch file
REM (Note: PGRM must also fit the LOCDEL naming pattern below so old versions delete OK.)
REM LOCDIR is the directory on the Client PC that will hold the working version of PGRM
REM FILNM is the prefix of the filename since a space is not recognised in the "set LOCDEL=" function.
REM LOCDEL is the pattern of files to delete in LOCDIR if the latest version
REM of PGRM can't be found (Note that the value of LOCDEL is case sensitive)
REM (Vital Note: TRIPLE CHECK the items you assign to LOCDIR and LOCDEL. Delete is
REM VERY unforgiving. NEVER EVER set LOCDIR to just C: or LOCDEL to *.*)
REM MSACC is the dos path to MS Access on the local PC.
REM SRVDIR is the directory on the Server to get the latest version of PGRM from.
REM WKGRP is the location of the access secure workgroup to use. (Note. Leave WKGRP blank
REM if you are using the standard MSAccess work group)
REM HKPATH is the directory of MouseHook.dll (%WinDir%\System\)
REM HKFILE is the MouseHook.dll file
[COLOR="SeaGreen"]
REM Check "HKEY_CLASSES_ROOT\.mdb\(Default Value)" for the version of Access installed;
REM "Access.Application.8" for Access 97
REM "Access.Application.9" for Access 2000
REM "Access.Application.10" for Access XP[/COLOR]
REM ***** THE VARIABLES *****
[COLOR="SeaGreen"]FOR /F "tokens=2* delims= " %%A IN ('REG QUERY HKEY_CLASSES_ROOT\.mdb /ve ') DO SET VERSION=%%B
ECHO %VERSION%
PAUSE[/COLOR]
SET PGRM="PIR CSC V2.4.mde"
SET LOCDIR="C:\Documents and Settings\%username%\WINDOWS"
SET FILNM="PIR "
SET LOCDEL=%FILNM%CSC*.*.mde
SET MSACC="C:\Program Files\Microsoft Access97\MSACCESS.EXE"
SET SRVDIR="\\csc-fs\CSC-CMS\PIR-DB\Back-End\97"
SET WKGRP=
SET HKPATH=%WinDir%\System
SET HKFILE="MouseHook.dll"
REM ***** COPY YOUR CURRENT FRONT END TO THE PC CLIENT *****
REM Check if the local directory LOCDIR exist's, if not then create it
REM If current version of PGRM does not exist in LOCDIR then:
REM 1. Keep the customers happy!
REM 2. Delete any old versions of PGRM from LOCDIR,
REM 3. Copy the new version of PGRM to LOCDIR
if not exist %LOCDIR% md %LOCDIR%
if not exist %LOCDIR%\%PGRM% echo Updating to the latest version of %PGRM%
if not exist %LOCDIR%\%PGRM% del %LOCDIR%\%LOCDEL%
if not exist %LOCDIR%\%PGRM% copy %SRVDIR%\%PGRM% %LOCDIR%\%PGRM%
if not exist %HKPATH%\%HKFILE% copy %SRVDIR%\%HKFILE% %HKPATH%\%HKFILE%
START /MAX %MSACC% %WKGRP% %LOCDIR%\%PGRM%
Thanks for posting the solution!!!