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!

Recommended Answers

All 2 Replies

Hi
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
[B]Example [/B]

Environment.SetEnvironmentVariable("MYVARIABLE", "MyValue", EnvironmentVariableTarget.Machine  );

Note: This method is new in the .NET Framework version 2.0.

Thank you very much... I assume the Value is the path.... Thank you...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.