Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to Skip in FOR command if a Directory does not exist. 6 79
how to split this type of line? 5 93
file size 9 50
Can we display time in 12 hr format using batch file ? 2 28
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

786 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