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 variables i...
Power Automate
Unanswered

How to use variables inside file paths

(0) ShareShare
ReportReport
Posted on by 31

I've created a variable storing the profile username and I want to reference the variable inside of a file path, but I'm getting an error message. When I hard-code the profile username into the file path the file opens successfully. I realized it's because the file path is line breaking after the variable, is there a way to fix this so I can include the variable inside the file path?

 

File path: C:\Users\%variable%\Downloads

Error message: Illegal characters in path.: Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.ActionException: Failed to read text from file C:\Users\sesa758156
\Downloads ---> System.ArgumentException: Illegal characters in path.

I have the same question (0)
  • Verified answer
    tgut03 Profile Picture
    31 on at

    Use the get windows environment variable action and select username. Set the variable equal to the environment variable value and the file path opens successfully. 

  • NathanAlvares24 Profile Picture
    1,714 Moderator on at

    .

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard