Sign in to follow this  
Followers 0
pr1

Running an application without specifying its full path

5 posts in this topic

Hello,

is there a way to run a third-party Windows application (such as Acrobat Reader, AcroRd32.exe) without specifying its full path?

For instance, I would like to do this:

Run <or any other command>("AcroRd32.exe", "", ...)

instead of

Run("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe", "", ...).

Like that, I could call any version of Acrobat Reader (7, 8, or 9) on any machine, without knowing its full path.

Many thanks.

pr1

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I just did it with Firefox and it worked fine. Run("Firefox.exe"). I don't have Acrobat Reader or I'd test that for you.

Edit: It fails for Foxit Reader.

Ok well, I'm done, sorry.

*facePALM* Maybe it worked for Firefox becuase I already had it open?

Edited by jaberwocky6669

Share this post


Link to post
Share on other sites

I don't think so !


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

pr1, Unless its added to the initial 'Path' environment string, you'll need to put the full path in. If you want it to be able to be run on other configurations though (where it could be installed to a different folder), you might want to search the registry for any keys that point to the folder and/or executable, and use the path found there.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

just verify if the application exists then execute it

Example:

for $i= 7 to 9
if FileExists("link to app...number of version store in variable $i") then
    Run("C:\Program Files\Adobe\Reader " & $i & ".0\Reader\AcroRd32.exe", "", ...).
    exitloop
endif
next
Edited by trung0407

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0