467,926 Members | 2,108 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

Installed program path

Is possible to find where program is installed in the cases if path is
changed during installation?

Can you point me to specific information? If possible, real code sample.

Thanks I appreciate your help.
Nov 17 '05 #1
  • viewed: 2295
Share:
6 Replies
Hello

It should be somewhere in registry. There is "Software" key in
HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER. Usually (a good manner) is to
create your own subkey under the software key for your application during
installation. So do most of installers (if you don't write your own). So,
try to check the registry.

--
With best regards,
Andrew

http://www.codeproject.com/script/pr...asp?id=1181072
"Washington" <ab******@yahoo.com> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Is possible to find where program is installed in the cases if path is
changed during installation?

Can you point me to specific information? If possible, real code sample.

Thanks I appreciate your help.

Nov 17 '05 #2
Hello

It should be somewhere in registry. There is "Software" key in
HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER. Usually (a good manner) is to
create your own subkey under the software key for your application during
installation. So do most of installers (if you don't write your own). So,
try to check the registry.

--
With best regards,
Andrew

http://www.codeproject.com/script/pr...asp?id=1181072
"Washington" <ab******@yahoo.com> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Is possible to find where program is installed in the cases if path is
changed during installation?

Can you point me to specific information? If possible, real code sample.

Thanks I appreciate your help.

Nov 17 '05 #3
Hi,

You can always find the directory path of the exe that started an
application using:

string myAppPath = Application.StartupPath;

Regards,

Rami Farhat


You can always use Application.

"Washington" wrote:
Is possible to find where program is installed in the cases if path is
changed during installation?

Can you point me to specific information? If possible, real code sample.

Thanks I appreciate your help.

Nov 17 '05 #4
Hi,

You can always find the directory path of the exe that started an
application using:

string myAppPath = Application.StartupPath;

Regards,

Rami Farhat


You can always use Application.

"Washington" wrote:
Is possible to find where program is installed in the cases if path is
changed during installation?

Can you point me to specific information? If possible, real code sample.

Thanks I appreciate your help.

Nov 17 '05 #5
"Rami Farhat" <Rami Fa****@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
Hi,

You can always find the directory path of the exe that started an
application using:

string myAppPath = Application.StartupPath;

Regards,

Rami Farhat


You can always use Application.


Wrong - only in a Windows Forms app can Application be used.

Even in a Windows Form app, I would still stay away from startup path, as
that does not actually indicate the location of the .exe file. For example,
if you had a shortcut to the EXE (say, on the start menu) you can go to it's
properties and change the startup path to some different directly.

The way I've normally gone about getting the location of the current exe is
to do something like this (if there is an easier way, let me know ;) )

string exeName = Assembly.GetExecutingAssembly().GetModules()[0].Name;
string path =
Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
path = path.Substring(0, path.Length - exeName.Length);

--
Adam Clauss
Nov 17 '05 #6
"Rami Farhat" <Rami Fa****@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
Hi,

You can always find the directory path of the exe that started an
application using:

string myAppPath = Application.StartupPath;

Regards,

Rami Farhat


You can always use Application.


Wrong - only in a Windows Forms app can Application be used.

Even in a Windows Form app, I would still stay away from startup path, as
that does not actually indicate the location of the .exe file. For example,
if you had a shortcut to the EXE (say, on the start menu) you can go to it's
properties and change the startup path to some different directly.

The way I've normally gone about getting the location of the current exe is
to do something like this (if there is an easier way, let me know ;) )

string exeName = Assembly.GetExecutingAssembly().GetModules()[0].Name;
string path =
Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
path = path.Substring(0, path.Length - exeName.Length);

--
Adam Clauss
Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Ray | last post: by
2 posts views Thread by =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.