ComfyUI > Nodes > Basic data handling > expand vars

ComfyUI Node: expand vars

Class Name

Basic data handling: PathExpandVars

Category
Basic/Path
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

expand vars Description

PathExpandVars node automates expanding environment variables in file paths for cross-system portability.

expand vars:

The PathExpandVars node is designed to simplify the process of handling file paths that include environment variables. This node automatically replaces environment variables within a given path string with their corresponding values, making it easier to work with dynamic paths that depend on the user's environment settings. This functionality is particularly useful when dealing with paths that need to be portable across different systems or user configurations, as it allows you to use placeholders like $HOME or ${HOME} on Unix systems, or %USERPROFILE% on Windows, which are then expanded to the actual directory paths. By automating this expansion, the node helps ensure that your file paths are always accurate and up-to-date with the current environment, reducing the risk of errors and improving the robustness of your workflows.

expand vars Input Parameters:

path

The path parameter is a string input that represents the file path containing environment variables to be expanded. This parameter is crucial as it specifies the path you want to process, and its value directly impacts the node's output by determining which environment variables will be expanded. The default value is an empty string, which means no path is provided initially. There are no explicit minimum or maximum values, but the path should be a valid string that can include environment variable placeholders like $VAR or ${VAR}.

expand vars Output Parameters:

expanded path

The expanded path output is a string that represents the file path after all environment variables have been expanded to their actual values. This output is essential as it provides the fully resolved path that can be used in subsequent operations or nodes. The expanded path ensures that any environment-specific placeholders are replaced with the correct directory paths, making it reliable for file operations.

expand vars Usage Tips:

  • Use the PathExpandVars node when you need to handle file paths that include environment variables, especially in scripts or workflows that need to be portable across different systems.
  • Ensure that the environment variables you use in the path are correctly set in your system's environment to avoid unexpected results.

expand vars Common Errors and Solutions:

Environment variable not set

  • Explanation: If an environment variable used in the path is not set, the node will not be able to expand it, resulting in an incomplete path.
  • Solution: Verify that all environment variables used in the path are correctly set in your system's environment. You can set them using your operating system's environment variable settings or within your script before using the node.

Invalid path format

  • Explanation: If the path string is not formatted correctly, the node may not be able to process it, leading to unexpected results.
  • Solution: Ensure that the path string is correctly formatted, using valid environment variable syntax like $VAR or ${VAR} for Unix systems, and %VAR% for Windows systems.

expand vars Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

expand vars