Solved

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

Posted on 2007-03-21
6
195 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
  • 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 500 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now