Use the GetEnvironmentVariable component
Retrieve the value of an environment variable by using the GetEnvironmentVariable component in RPA Desktop Design Studio. For example, you can get the value of the TEMP variable.
Before you begin
Role required: none
About this task
You can configure the properties for the GetEnvironmentVariable component. For more information about these properties, see Properties of the Environment components.
Procedure
GetEnvironmentVariable component
You want your robot to process files and save logs to different folders depending on whether it's running in Development or Production mode.
- At the start of the automation, use SetEnvironmentVariable to define the following variables:
ENV_MODE = DevelopmentLOG_PATH = C:\RPA\Dev\Logs
This variable defines if robot is running in the development mode, where to store the log files.
- Later in the workflow, when saving log files, use GetEnvironmentVariable to retrieve the value of
LOG_PATH.The robot dynamically stores the log files as per the value in the
LOG_PATHvariable. - In production, simply update the environment variable setup to:
ENV_MODE = ProductionLOG_PATH = C:\RPA\Prod\Logs
The robot now logs to the production folder automatically, because it reads the
LOG_PATHvalue from the environment variable.