?
Solved

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

Posted on 2003-03-06
9
Medium Priority
?
9,001 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
9 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

762 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