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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Backslash during text ...
Power Automate
Answered

Backslash during text handling

(0) ShareShare
ReportReport
Posted on by 19

I have searched but not found relevant post. 

 

I am composing the Windows file path with "Set variable" action in Power Automate Desktop. However, I found that once I use backslash mark, it generate syntax error.

 

I have two string variables. One is the basic path. Another one is the remaining part of the path, which is dynamic. I need to "concatenate" them together. Therefore I use "set variable" action and write as following.

 

%OneVariable + 'abc' + AnotherVariable%

 

 

 However it generate syntax error. If I change the character \ backslash to any other letter, e.g. 'abc'. It works. Like this.

 

%OneVariable + '\' + AnotherVariable%

 

 

Is there any workaround? for example in some other language I can use CHR(92) to replace this backslash.

Thank you.

  • Ding_Zhang Profile Picture
    19 on at

    Sorry I have put wrong sequence of the sample code in my post above. It should be like this:

     

    This one generates syntax error:

    %OneVariable + '\' + AnotherVariable%

     

    This one works well:

    %OneVariable + 'abc' + AnotherVariable%

      

  • UK_Mike Profile Picture
    on at

     

    This is a file path that joins 3 vars to make the full path, is this what you're after ?

     

    %NewVar%%NewVar2%%NewVar3%

  • Ding_Zhang Profile Picture
    19 on at

    Thank you for your reply. I would like to join two variables together to make the full path.

     

    Just when I type here, it seems that I found the solution. I tried using '//' two backslash and it seems work well.

     

    Thank you for your help!

  • Verified answer
    Ding_Zhang Profile Picture
    19 on at

    sorry, a typo. It should be '\\' instead of '//'. In summary, if I would like to use backslash during joining two or more text variables, I found I need to use '\\' to avoid syntax error.

     

    This will generate syntax error:

    %OneVariable + '\' + AnotherVariable%

     

    This will not generate syntax error:

    %OneVariable + '\\' + AnotherVariable%
  • UK_Mike Profile Picture
    on at

    Well you could always set a var.

    var name = %Slash% with a value of \

     

    Therefore 

    %NewVar%%Slash%%NewVar2%%Slash%%NewVar3%

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 423

#2
11manish Profile Picture

11manish 308 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 177

Last 30 days Overall leaderboard