EnvironmentAliases.

EnvironmentVariable(ICakeContext, string) Method

Summary

Retrieves the value of the environment variable or null if the environment variable does not exist.
Namespace
Cake.Common
Containing Type
EnvironmentAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Environment Variables")]
public static string EnvironmentVariable(this ICakeContext context, string variable)

Examples

Information(EnvironmentVariable("HOME") ?? "Unknown location");

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.
CakeAliasCategoryAttribute An attribute used for documentation of alias methods/properties.

Parameters

Name Type Description
context ICakeContext The context.
variable string The environment variable.

Return Value

Type Description
string The environment variable or null if the environment variable does not exist.