473,651 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

path environment variable

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
Nov 16 '05 #1
1 2453
Bonj,

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

HKEY_LOCAL_MACH INE\System\Curr entControlSet\C ontrol\Session
Manager\Environ ment

Once you do that, make sure you broadcast a WM_SETTINGCHANG E 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_US ER\Environment

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
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

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
17471
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.IOException: The directory name is invalid.
1
2240
by: jwpioneer | last post by:
I have a need within an application to modify the path environment variable, as I need to find specific directories and remove them. I use the following code to do this: RegistryKey rkey = null; rkey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Session Manager\Environment",true); string p = (String)rkey.GetValue("Path"); string pp = p.Split(';');
10
12832
by: wen | last post by:
on my system(win2k server, python 2.3.5), >>> import sys >>> print sys.path now, i wanna add "C:\Python23\Pmw\Pmw_1_2\lib" into sys.path, how? any help would be appreciated. with my kind regards,
1
9704
by: Chris B | last post by:
I have an application that uses PInvoke to call into native DLLs. My DLLimport attribute only has the name of the DLL that I need to import (i.e. I leave it up to the OS to search the PATH for the DLL.) This all works great when the user's PATH variable is setup correctly. Unfortunately, there are times when the user's PATH is too full or whatever to have the correct search path for my application. What I was wondering is if there is...
4
39083
by: | last post by:
Hi all, I am trying to append a certain string to the PATH environment variable programmatically. I am able to read what is in the variable using the System.Environment method GetEnvironmentVariable("path"). However, I don't know yet how to append strings to the path variable. Any help is appreciated. Thanks a lot.
6
6410
by: Garfield | last post by:
We have written a small function to append a couple of paths to the path environmental variable. The code is: string PathValue = ""; string sAdd = ""; sAdd = ";" + <path1> + "Bin;" + <path2>; PathValue = System.Environment.GetEnvironmentVariable("Path"); PathValue += sAdd;
1
5812
by: Colmag | last post by:
I remember setting the PATH environment variable from years back, but haven't touched it since win95 days. Now i have to add a couple of lines to it using vb.net so that a console app will work properly. I've read that at the moment you can only get environment variables, and that vb.net 2005 will allow you to set them. Does anyone know how to add to the PATH variable using vb.net 2003?
3
3895
by: HMS Surprise | last post by:
Is sys.path setup differnently in jython vs python? I have environment variables pythonpath and jythonpath set to include C:\python22 but the initial printout indicates it is being ignored. Also when I used sys.path.extend, the added pathname shows up as a series of single characters. Have I misused .extend? Thanks, jh
2
1435
by: Blair | last post by:
Hello, I have a old enviromantal path in LIB file that, every time I compile gives a error message. It does not stop the compiler just gives a warning. This has become very annoying. I would like to delete out of the listing as I don't use the LIB anymore, but I am lost as how to do it.
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.