environment.opIndex

Retrieves the value of the environment variable with the given name.

auto path = environment["PATH"];
class environment
static @safe
string
opIndex
(
scope const(char)[] name
)

Throws

$(OBJECTREF Exception) if the environment variable does not exist, or std.utf.UTFException if the variable contains invalid UTF-16 characters (Windows only).

See Also

environment.get, which doesn't throw on failure.

Meta