?
Solved

Check the existence of a registry key with a batch file (DOS)

Posted on 2003-03-06
9
Medium Priority
?
9,011 Views
Last Modified: 2007-12-19
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\SOFTWARE\Microsoft\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\SOFTWARE\Microsoft\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.
0
Comment
Question by:upstatenewyorker
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 43

Expert Comment

by:Steve Knight
ID: 8084321
I would say checking for a different file that exists would be much easier from a batch.  There are plenty of command line utils that could check for registry entries too but you say no external apps.

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
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 8084336
It seems 8.3 filenames are the order of the day for that though...

if exist "c:\progra~1\micros~1\office\mso9.dll" set version=Acc2000

Steve
0
 

Expert Comment

by:Lord_Lethris
ID: 8084394
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!)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:Lord_Lethris
ID: 8084440
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.
0
 

Author Comment

by:upstatenewyorker
ID: 8087949
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.
0
 

Author Comment

by:upstatenewyorker
ID: 8088008
Also, what is the dll for Access XP?  Does anyone know?
0
 
LVL 1

Expert Comment

by:geofflilley
ID: 10032471
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
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 10315456
PAQed, with points refunded (50)

SpazMODic
EE Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question