how to get installed program path under Windows like Win32 API?

Discussion in 'Perl Misc' started by Lance, Mar 27, 2005.

  1. Lance

    Lance Guest

    how to get installed program name/path pair under winXP like Win32 API
    does?

    Though I do know it's not so conform to this group's posting law for
    such a brief description which is absent of exact input and expected
    output. However I can't describe my question in that detail. Sorry for
    that.

    Any solution or hint is appreciated very much.
     
    Lance, Mar 27, 2005
    #1
    1. Advertising

  2. Lance

    Bob Walton Guest

    Lance wrote:

    > how to get installed program name/path pair under winXP like Win32 API
    > does?


    Not sure what the question is supposed to be. Does the $^X
    variable answer it (see perldoc perlvar)? That returns the
    path/filename of the Perl executable which is running the script.
    ....
    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
     
    Bob Walton, Mar 27, 2005
    #2
    1. Advertising

  3. Lance

    Lance Guest

    Hi Bob, thanks for your reply.

    Nevertheless there's a little bit misunderstanding for you. The
    installed program I mean here is not the path of perl.exe, but other
    installed programs, such notepad.exe, msword.exe, photoshop.exe etc.

    What I want here is the method to get out the path from the likely
    execution file name. For example, if the Microsoft word is installed at
    C:\wordXP\, whose execution file is msword.exe under C:\wordXP\. The
    program input is the likely name of the execution file, such word,
    msword etc. the expected out is the execution file path
    c:\wordXP\msword.exe.

    Is my current description detail enough? :) Any information is welcome.
     
    Lance, Mar 28, 2005
    #3
  4. "Lance" <> wrote in
    news::

    > Hi Bob, thanks for your reply.


    [ Please quote an appropriate amount of context ]

    > Nevertheless there's a little bit misunderstanding for you.


    I don't think he misunderstood, rather you have failed to explain.

    > The installed program I mean here is not the path of perl.exe, but
    > other installed programs, such notepad.exe, msword.exe, photoshop.exe
    > etc.


    In your original message, you mention the Win32 API. Maybe, if you told
    us which Win32 API function does what you want, we might be able to
    figure out exactly what you are looking for.

    > What I want here is the method to get out the path from the likely
    > execution file name.


    How do you figure out what the "likely execution file name" is?

    > For example, if the Microsoft word is installed at
    > C:\wordXP\, whose execution file is msword.exe under C:\wordXP\. The
    > program input is the likely name of the execution file, such word,
    > msword etc. the expected out is the execution file path
    > c:\wordXP\msword.exe.


    sub msword_path { 'C:/wordXP/msword.exe' }

    > Is my current description detail enough? :)


    No.

    For the example above you describe, what arguments whould you call the
    function with, and expect to get the full path of the main executable of
    the installed package?

    Sinan.
     
    A. Sinan Unur, Mar 28, 2005
    #4
  5. * Lance schrieb:
    >
    > Nevertheless there's a little bit misunderstanding for you. The
    > installed program I mean here is not the path of perl.exe, but other
    > installed programs, such notepad.exe, msword.exe, photoshop.exe etc.
    >
    > What I want here is the method to get out the path from the likely
    > execution file name. For example, if the Microsoft word is installed at
    > C:\wordXP\, whose execution file is msword.exe under C:\wordXP\. The
    > program input is the likely name of the execution file, such word,
    > msword etc. the expected out is the execution file path
    > c:\wordXP\msword.exe.


    Sometimes I'd installed a new update for a program, I'd got a popup that
    told me Windows is searching for the current path of this program.
    Usually this takes up several minutes until the path is found. Therefore
    I think you have to look into all possible paths if you really want to
    do this for any executable you have on your disk.

    But sometimes programs add an entry into the registry where anyone can
    look up to get this information. But these entries are program-specific
    and there is AFAIK no standardized location for.

    So I'll suggest you scan all your program and system directories to find
    your corresponding executable. Have a look at File::Find for doing this
    comfortably.

    regards,
    fabian
     
    Fabian Pilkowski, Mar 29, 2005
    #5
  6. Lance

    Joe Smith Guest

    Lance wrote:
    > The installed program I mean here is but other
    > installed programs, such notepad.exe, msword.exe, photoshop.exe etc.


    Programs that are started by clicking on an icon can be in any
    directory. Icons that are shortcuts often have the full path
    of the application stored as a property. To get that info,
    you may have to track down and locate all possible icons and/or
    parse the Registry.
    -Joe
     
    Joe Smith, Apr 5, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Learner
    Replies:
    4
    Views:
    2,111
    Learner
    Jan 27, 2006
  2. john san
    Replies:
    19
    Views:
    763
    Diez B. Roggisch
    Feb 18, 2005
  3. xman
    Replies:
    2
    Views:
    510
    Sayajin
    Aug 15, 2005
  4. Replies:
    2
    Views:
    163
    bbiker
    Oct 25, 2007
  5. Thomas Thomassen
    Replies:
    2
    Views:
    167
    Thomas Thomassen
    Dec 29, 2010
Loading...

Share This Page