Finding the path of an application?

A

Amjad

Hi
How can I get the path of an application that has been
already installed on my PC using VB?

For example, I want my program to find and store the path
of Excel.exe

I think I have to search the registry, but I don't know
how. Any help?
Amjad
 
M

Morpheu

Why do you need that?

I ask because you will have a problem with the location of applications that
are not registered.

Regards,
Morpheu
 
A

Amjad Farran

I want to extract data from a file that is created using a particular
software and stored in the same folder. Now since the user could have
installed that software anywhere on his hardisk, I would like to be able
to know where the created files are stored.

The software application is registered.

Amjad
 
H

Herfried K. Wagner [MVP]

* "Amjad said:
How can I get the path of an application that has been
already installed on my PC using VB?

For example, I want my program to find and store the path
of Excel.exe

This depends on the application you are looking for.
 
M

Morpheu

Well,
You know one key from registry where you can found this information?
If know you can retrieve this information.
Else you can make a function that uses filesystem to sweep disk searching
application for its name. It will be very slow.

Morpheu
 
A

Amjad Farran

Ok. Let's assume that I'm looking for the location path of Microsoft
Word (WinWord.exe)

Amjad
 
H

Herfried K. Wagner [MVP]

* Amjad Farran said:
Ok. Let's assume that I'm looking for the location path of Microsoft
Word (WinWord.exe)

I am not sure, if it will work on all versions:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe
 
T

Tom Shelton

Ok. Let's assume that I'm looking for the location path of Microsoft
Word (WinWord.exe)

Amjad

You can try and use AssocQueryString to find an executable, or you can
use FindExecutable if you want to look it up by extension.
 
A

Amjad Farran

Thanks for replying. Can you give me the complete code line?

For example:

Dim myWinWordPath as String

myWinWordPath =
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\Winword.exe

Amjad
 
H

Herfried K. Wagner [MVP]

* Amjad Farran said:
Thanks for replying. Can you give me the complete code line?

For example:

Dim myWinWordPath as String

myWinWordPath =
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\Winword.exe

Sorry, that's a path in the registry. Have a look at the
'Microsoft.Win32.Registry' class.
 

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

Top