0

Some of our computers run multiple versions of Microsoft Access (97 & 2010) while others run 365. For the pcs running multiple versions, the default is set to 97. I have a batch file that is performing various tests to see if files exist, and finished by running an Access 2010 database called MWO.accdb. See below.

if exist c:\windows\system32\mscomct2.ocx goto step2

rem copy mscomct2 and register
cscript \\file\apps\Database\Maintenance\365\MsgBox.vbs "Preparing necessary libraries."
copy "\\file\apps\Database\Maintenance\365\mscomct2.ocx" "c:\windows\system32\"
regsvr32 /u mscomct2.ocx
regsvr32 /i mscomct2.ocx

:step2

if exist "%USERPROFILE%\Desktop\MWO.lnk" goto step3

rem create shortcut on user's desktop for future use
cscript \\file\apps\Database\Maintenance\365\MsgBox.vbs "Creating shortcut on desktop & adding to start menu."
copy "\\file\apps\Database\Maintenance\MWO-INSTALL.lnk" "%USERPROFILE%\Desktop\MWO.lnk"
mkdir "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Maintenance"
copy "\\file\apps\Database\Maintenance\MWO-INSTALL.lnk" "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Maintenance\MWO.lnk"

:step3
\\file\apps\Database\Maintenance\365\MWO.accdb

Is there an easy way to test for the latest version of access, and force the file to open with it to avoid the defaulting to 97 problem?

steve_g
  • 1
  • 1

1 Answers1

0
wmic product where caption="Access" get caption,version

(I don't have access installed, the captionstring may differ)

Stephan
  • 53,940
  • 10
  • 58
  • 91