Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 2.02 KB

File metadata and controls

38 lines (30 loc) · 2.02 KB
title SetEnv task
description Learn how MSBuild uses the SetEnv task to set or delete the value of a specified environment variable.
ms.date 11/05/2018
ms.topic reference
f1_keywords
vc.task.setenv
dev_langs
C++
helpviewer_keywords
MSBuild (C++), tasks
SetEnv task (MSBuild (C++))
author ghogen
ms.author ghogen
ms.subservice msbuild

SetEnv task

[!INCLUDE C++-specific 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.
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.

See also