web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to use environment...
Power Automate
Unanswered

How to use environment variable in power automate desktop?

(1) ShareShare
ReportReport
Posted on by 357

Hi Team,

 

I want use env variable in PAD.

 

I want to store mail ids in env var and use that in pad email action.

If in future I want to change mail id then I dont want to go to code and change in code . 
Instead just change in env var.

I have the same question (0)
  • VishnuReddy1997 Profile Picture
    2,656 Super User 2025 Season 2 on at

    Hi @Sanket1 ,

     

    In Power Automate Desktop, you can’t directly access environment variables from a desktop flow. However, here are a couple of workarounds:

     

    1.Input Parameters:


    Create input parameters in your desktop flow.
    When invoking your desktop flow from a cloud flow, pass the environment variable values as input to your Power Automate Desktop flow.

     

    2.Get Windows Environment Variable:
    If you’re looking for machine-related variables (not Power Platform environment variables), use the “Get Windows Environment Variable” action in Power Automate Desktop.
    This action allows you to retrieve system environment variables.


    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

  • Verified answer
    NathanAlvares24 Profile Picture
    1,714 Moderator on at

    Hi @Sanket1 !

     

    First you would need to create an environment variable for that to happen. As you cannot create environment variables in PAD.

     

    • Open the Start menu, search for "Environment Variables," and select "Edit the system environment variables."
    • In the System Properties window, click the "Environment Variables" button.
    • In the Environment Variables window, click "New" under the "System variables" section.
    • Enter the variable name (e.g., MailIds) and the variable value (e.g., example1@example.com;example2@example.com). Click "OK" to save.

     

    NathanAlvares24_1-1720775088988.png

     

    Then you can use the action "Get environment variable", specify the name of the environment variable here for me it is "Mailids" (take from the dropdown) and then use that variable for your "Send email" action.

    NathanAlvares24_2-1720775319038.png

     

    Please note for sending multiple people you would need each email id separated with semi colon ';'

    NathanAlvares24_3-1720775379316.png

     

    I also have other better methods as I use these in my work:

    Method 1: Use an XML config file

    This is a much cleaner method. All you need to do is create an XML file and store the email Ids in that. And then use XML actions from PAD to get the info from the XML file using Xpath.

     

    NathanAlvares24_6-1720776059635.png

     

    NathanAlvares24_7-1720776303041.png

     

    NathanAlvares24_8-1720776329173.png

     

     

    Method 2: Use the Dataverse Tables

    This is a more secure method and its a new feature introduced in Power Automate Desktop.

     

    All you need to do is create a table in Power Apps, add the information in that, and then use Dataverse actions in Power Automate Desktop. So in this there is no need to update the input variables in PAD, just update the information in your Dataverse table.

     

    Let me show you what I usually do this for:

    I usually use Dataverse tables for credentials which are sensitive data as there is no credential vaults or if you need a credential vault like CyberArk or Azure you would need to pay which is for sure nobody will do that. Dataverse is free and security is high.

     

    NathanAlvares24_4-1720775797012.png

     

    This is mostly used if you are using "send email" action in PAD.

     

    Then in PAD you just have to use these actions,

    NathanAlvares24_5-1720775797110.png

     

    Method 3: Use Power Automate Cloud and Desktop combined, create env. variable in a solution, and then use that variable as input for "Run a flow built with Power Automate for desktop" action

    All you need to do is create a solution, import your cloud flow into that solution. This cloud flow should contain the action, "Run a flow built with Power Automate for desktop". Then create an environment variable, type in the path in the default value field, edit your cloud flow, add your environment variable in that. And Voila!! Just run your flow. See below:

    Add existing cloud flow or you can create a new one.

    NathanAlvares24_0-1720776506200.png

     

    Add the environment variable. Only this needs to be updated

    NathanAlvares24_1-1720776505980.png

     

     

    NathanAlvares24_2-1720776505906.png

     

     

    NathanAlvares24_3-1720776505977.png

     

    All this can happen only if your desktop has an input variable. That's when you can add the environment variable to your cloud flow as it gives a prompt to enter an input field.

    NathanAlvares24_4-1720776506169.png

     

     

  • Sayan Profile Picture
    818 Super User 2025 Season 2 on at

    Hey @Sanket1 

     

    In Power Automate You Can't Access Env variable directly. You can store in your Windows System.

     

    Also If you can store the Values in Excel and you can Access easily. When you need to change the value you have to change it only in Excel.

     

    Please Refer the below Video for more :

    Config File in PAD 

     

     

    ------------------------------------------------------------------------------------------------------------------------------

    If my suggestion helps you Give a Thumbs up and Marks as a Solution. It motivates to solve more problems.

    Thanks,

    Sayan Patra

    RPA Developer

  • Rahul_Patel Profile Picture
    5 on at
    Thank you so much @NathanAlvares24-You are awesome man

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard