Solved

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

Posted on 2007-03-21
6
196 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

19 Experts available now in Live!

Get 1:1 Help Now