Finding the path of an application?

  • Thread starter Thread starter Amjad
  • Start date Start date
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
 
Why do you need that?

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

Regards,
Morpheu
 
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
 
* "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.
 
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
 
Ok. Let's assume that I'm looking for the location path of Microsoft
Word (WinWord.exe)

Amjad
 
* 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
 
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.
 
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
 
* 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.
 
Back
Top