upstatenewyorker
asked on
Check the existence of a registry key with a batch file (DOS)
I want to be able to see if a machine has Access 97 on it or Access 2000. I decided I could check this by looking for the existence of the following key:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Office\9 .0\Access
I need to check for the existence of this key via a batch file (DOS). I would like a way to easily check the existence of this key without using external files, example of which below,
REGEDIT /E file.txt HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Office\9 .0\Access
FIND " " < file.txt
if errorlevel=1 echo Value not found!
This is not a good way of going about it because if the key doesn't exist, the file isn't created, then I would have to code for the existence of the text file. There has to be an EASIER and CONCISE way of doing this. Can anyone help?
And, if you can think of a way to check versions of Microsoft Access via a batch file that does not deal with the registry and is EASY and CONCISE, then please share your ideas with me.
HKEY_LOCAL_MACHINE\SOFTWAR
I need to check for the existence of this key via a batch file (DOS). I would like a way to easily check the existence of this key without using external files, example of which below,
REGEDIT /E file.txt HKEY_LOCAL_MACHINE\SOFTWAR
FIND " " < file.txt
if errorlevel=1 echo Value not found!
This is not a good way of going about it because if the key doesn't exist, the file isn't created, then I would have to code for the existence of the text file. There has to be an EASIER and CONCISE way of doing this. Can anyone help?
And, if you can think of a way to check versions of Microsoft Access via a batch file that does not deal with the registry and is EASY and CONCISE, then please share your ideas with me.
It seems 8.3 filenames are the order of the day for that though...
if exist "c:\progra~1\micros~1\offi ce\mso9.dl l" set version=Acc2000
Steve
if exist "c:\progra~1\micros~1\offi
Steve
OK... if I've got my head around this one, you replace the
if errorlevel=1 echo Value not found!
with the following, replacing the [??] entries with whatever is needed.
=========================
if errorlevel=1 goto :ERR
GOTO :END
:ERR
copy [from wherever]\file.txt [to wherever]
REM this file.txt will contain text like ACCESS Not FOUND
:END
=========================
I hope thats what your on about, that way if the exsistance of ACCESS isn't found then it will copy a pre made .txt file with whatever you want in it to wherever your saving the .txt files too.
(Phew!)
if errorlevel=1 echo Value not found!
with the following, replacing the [??] entries with whatever is needed.
=========================
if errorlevel=1 goto :ERR
GOTO :END
:ERR
copy [from wherever]\file.txt [to wherever]
REM this file.txt will contain text like ACCESS Not FOUND
:END
=========================
I hope thats what your on about, that way if the exsistance of ACCESS isn't found then it will copy a pre made .txt file with whatever you want in it to wherever your saving the .txt files too.
(Phew!)
Steve's right about there being plenty of apps out there that will search for software. If your worried about licencing issues, there are freeware ones. Or for $200 (dunnow what this might be in other contries) you can get EZ-Audit. Excelent package, and you can run it on login without having to install it on all the PC's. the evaluation copy lets you run audits BUT you can only View 5 PC's at a time.
http://www.ezaudit.net/reg/default.htm
take a look. We brought this in the end, 'cos in the long run it saved us a hell of a lot of work over the years.
http://www.ezaudit.net/reg/default.htm
take a look. We brought this in the end, 'cos in the long run it saved us a hell of a lot of work over the years.
ASKER
I had already thought about the mso9.dll, however, our departments have Office 97 for Access, Excel and Powerpoint. They also have Outlook 2000, which I believe dumps the dll on the hard drive as part of the installation. So, then that's when I looked into the registry issue. This is very complicated, that's for sure. Is there another file on the hard drive which is indicative of an Access 97 or 2000 installation?
I appreciate all your help. I really do.
I appreciate all your help. I really do.
ASKER
Also, what is the dll for Access XP? Does anyone know?
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Delete question, refund points
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Geoff Lilley
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Delete question, refund points
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Geoff Lilley
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
set version=Acc97
if exist "c:\program files\microsoft office\office\mso9.dll" set version=Acc2000
or another DLL that you know gets installed as part of the build on your machines...
Steve