Compartilhar via


SetEnv Task

Sets or deletes the value of a specified environment variable.

Parameters

The following table describes the parameters of the SetEnv task.

Parameter

Description

Name

Required String parameter.

The name of an environment variable.

OutputEnvironmentVariable

Optional String output parameter.

Contains the value that is assigned to the environment variable that is specified by the Name parameter.

Prefix

Mandatory Boolean parameter.

If true, concatenates the value of the Value parameter before the value of the environment variable that is specified by the Name parameter, and then assigns the result to the environment variable. If false, assigns only the value of the Value parameter to the environment variable.

Target

Optional String parameter.

Specifies the location where an environment variable is stored. Specify "User" or "Machine".

For more information, see "EnvironmentVariableTarget Enumeration" on the MSDN Web site.

Value

Optional String parameter.

The value assigned to the environment variable that is specified by the Name parameter. If Value is empty and the variable exists, the variable is deleted. If the variable does not exist, no error occurs even though the operation cannot be performed.

For more information, see "Environment::SetEnvironmentVariable Method" on the MSDN Web site.

See Also

Other Resources

MSBuild Task Reference