Environment: SetEnvironmentVariable

SetEnvironmentVariable

Sets, creates, or deletes an environment variable in the specified region.

 Public Sub SetEnvironmentVariable(
	  ByVal Variable As String,
	  ByVal Value As String,
	  Optional ByVal Target As EnvironmentVariableTarget = Process )

Parameters

Variable
[ByVal] String. The name of the variable to set the value for.
Value
[ByVal] String. The value of the variable.
Target
[ByVal] Optional. EnvironmentVariableTarget. The region the variable is located in the system.  

Default: Process

Remarks

Setting the variable in the Process region only affects the current process that is setting the variable. Setting a variable in a User or Machine region will set the values in the registry.

by setting the value to an empty string, the variable will be deleted.

See Also

Project VBCorLib Overview | Class Environment Overview