Skip to main content

Get Env Variable

Returns the value of the specified environment variable.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if the Catch node is used.

Input

  • Variable Name - Name of the environment variable to get. (e.g. DISPLAY or HOME)

Output

  • Value - Value of the environment variable.

How It Works

The Get Env Variable node retrieves environment variable values from the operating system in a simple process:

  1. The node receives the variable name as input
  2. It validates that the variable name is not empty
  3. It queries the operating system for the environment variable value using the provided name
  4. The retrieved value (or empty string if not found) is stored in the output variable
  5. The message passes to the next node with the retrieved value

Requirements

  • Variable Name: Must be a valid, non-empty environment variable name
  • Operating System: Works on all platforms (Windows, Linux, macOS)
  • Permissions: Standard user permissions (no special privileges required)

Error Handling

Error CodeDescriptionSolution
Core.Process.GetEnvVariable.ErrOnCreateConfiguration parsing failed during node creationCheck node configuration in the flow
Core.Process.GetEnvVariable.OnMessageMessage parsing errorVerify message format is valid JSON
Core.Process.GetEnvVariableVariable name is emptyProvide a valid variable name
Core.Process.GetEnvVariable.OutputMarshalFailed to serialize outputCheck output variable configuration

Usage Examples

Example 1: Get User's Home Directory

// Get the HOME environment variable (Linux/macOS) or USERPROFILE (Windows)
msg.variableName = "HOME";
// After node execution:
// msg.homeDir contains "/home/username" or similar

Example 2: Get System Path

// Retrieve the PATH environment variable
msg.varName = "PATH";
// After node execution:
// msg.pathValue contains the system PATH variable
// Can be used to verify executable locations

Example 3: Get Custom Application Variable

// Get a custom environment variable set by another application
msg.envVar = "JAVA_HOME";
// After node execution:
// msg.javaHome contains the Java installation path
// Returns empty string if not set

Usage Notes

  • If the environment variable does not exist, the node returns an empty string (not an error)
  • Environment variable names are case-sensitive on Linux/macOS
  • On Windows, environment variable names are case-insensitive
  • The node retrieves variables from the current process environment
  • Changes to environment variables made during flow execution will be reflected
  • System-wide environment variables and user-specific variables are both accessible

Tips

  • Always check if the returned value is empty before using it in subsequent operations
  • Use this node to make flows portable across different environments
  • Common variables: HOME, PATH, TEMP, USER, DISPLAY (Linux), USERPROFILE (Windows)
  • Store configuration in environment variables rather than hardcoding values in flows
  • Combine with conditional nodes to handle cases where variables might not be set
  • Start Process - Use environment variables to locate executable paths
  • File Operations - Combine with file nodes to work with paths from environment variables
  • String Operations - Process retrieved values (split PATH, extract portions, etc.)