environment.opIndex

string opIndex(scope const(char)[] name) @safe

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

auto path = environment["PATH"];

Throws

Exception if the environment variable does not exist,

or UTFException if the variable contains invalid UTF-16 characters (Windows only).

See_also:

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