path environment variable

G

Guest

Hi

My application installs a front-end GUI, which runs code when buttons are
clicked. It also installs a command-line utility, that is a console
application.

They are both installed to the program's application directory, along with
the DLL that contains the generic code that they both call.
My question is, is there any way of modifying the environment variable
permanently with the setup project, such that the user has got the program's
directory in their path, so that when they start a command prompt and type
the name of the application it will start? In a similar way to which
sdkvars.bat does, but permanently.
I know they will want to do this.

Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

Bonj,

Yes, you can do this. You will want to modify the values in the
following registry key:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session
Manager\Environment

Once you do that, make sure you broadcast a WM_SETTINGCHANGE message, so
that other programs know that an environment variable has changed. If you
want to add the environment variable for the current user, then modify the
following registry key:

HKEY_CURRENT_USER\Environment

Hope this helps.
 

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