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

L

Lance

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.
 
B

Bob Walton

Lance said:
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.
....
 
L

Lance

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.
 
A

A. Sinan Unur

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.
 
F

Fabian Pilkowski

* Lance said:
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
 
J

Joe Smith

Lance said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top