Compartir a través de


SetEnv Task

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Remarks

See Also

Task Reference