?
Solved

Batch file to start one program if found installed if not found start a different one

Posted on 2007-03-21
6
Medium Priority
?
210 Views
Last Modified: 2010-04-16
My workstations have Adobe Reader and Adobe Standard installed on them.  The executable to open pdf files is acrobat.exe in Standard version and acrord32.exe in Reader version.  Both programs are needed on workstation to work with special applications.  However, one of these Windows 3rd party application uses a .bat file to start acrord32.exe to view or print the pdf file.  However, those workstations that have the Standard version installed this batch of course if not working.  I need to modify this batch file to have it check to see if acrobat.exe is installed and if it is start the program if not found to start acrord32.  This is what the batch file currently has:

:acrobat
if (%2) == (/V) goto viewpdf
start acrord32 %2 %3
goto end

:viewpdf
start acrord32 %3
goto end

Any help would be appreciated.
0
Comment
Question by:clpease
[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
  • 3
6 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18763567
Hmm - why not let the OS choose?

:acrobat
if (%2) == (/V) goto viewpdf
start %2 %3
goto end

:viewpdf
start %3
goto end

Start should then open the PDF with the correct reader...
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 18763603
Otherwise, assuming the installation target is the same...

:acrobat
if (%2) == (/V) goto viewpdf
if exist "%programfiles%\Adobe Acrobat 7.0\Reader\acrord32.exe" start acrord32 %2 %3 && goto end
acrobat %2 %3
goto end

:viewpdf
start acrord32 %3
goto end
0
 

Author Comment

by:clpease
ID: 18779530
The users I want to test this on have been out of the office.  I will have to wait until next week when they return.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18779576
Alright...keep us posted. ;^)
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

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