Skip to content

Environment

Overview

The Environment type provides system environment access. All methods are static.

Methods

MethodSignatureDescription
GetVariable(string name) -> stringGet environment variable (empty if not set)
SetVariable(string name, string value)Set environment variable

Properties

PropertyTypeDescription
CurrentDirectorystringCurrent working directory
ProcessIdintCurrent process ID
TickCountintMilliseconds since system start

Example

string path = Environment.GetVariable("PATH");
int pid = Environment.ProcessId;
string cwd = Environment.CurrentDirectory;
Environment.SetVariable("MY_VAR", "hello");