| | |
Setting Environment Variable using C#
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
Hi ! I am working on this project; the thing is that I want my program to create it's own environment variable path so it can be called from and used in CMD too. How can I do this... Googling hasn't been any help yet. Thanks in advance!
"By the data to date, there is only one animal in the Galaxy dangerous to man—man himself. So he must supply his own indispensable competition. He has no enemy to help him."
From Time Enough for Love by Robert A. Heinlein
From Time Enough for Love by Robert A. Heinlein
Hi
U can use
Note: This method is new in the .NET Framework version 2.0.
U can use
public static void SetEnvironmentVariable (
string variable, string value,
EnvironmentVariableTarget target
)
or
public static void SetEnvironmentVariable (
string variable, string value,
)
EnvironmentVariableTarget target Takes Three values
> Machine
> User
> Process
Example
Environment.SetEnvironmentVariable("MYVARIABLE", "MyValue", EnvironmentVariableTarget.Machine );Note: This method is new in the .NET Framework version 2.0.
KSG
![]() |
Similar Threads
- Upload_err_no_tmp_dir (PHP)
- Please Help me......error in compiling (Java)
- Help with htaccess (IT Professionals' Lounge)
- Python path HELP (Python)
- NoClassDefFoundError (Java)
- Losing session variable problem...help! (ASP)
- Setting a variable to the Exit Code (Python)
- Windows XP Prof BSOD when playing games (Windows NT / 2000 / XP)
- I need help with setting up a "Path"...... (Python)
Other Threads in the C# Forum
- Previous Thread: asp.net + c# very urgent
- Next Thread: managing object in callback
| Thread Tools | Search this Thread |
.net access algorithm alignment app array barchart bitmap box broadcast c# c#gridviewcolumn cast check checkbox client combobox communication concurrency control conversion csharp custom database datagrid datagridview dataset datatable datetime degrees development draganddrop drawing elevated encryption enum excel file focus form format forms function gdi+ hospitalmanagementsystem image index input install java label list listbox localization login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml





