# Escaping backslashes in CI output

**URL:** <https://www.finalbuilder.com/forums/t/escaping-backslashes-in-ci-output/7354>\
**Category:** Bugs\
**Created:** [May 19, 2023, 1:34pm UTC](https://www.finalbuilder.com/forums/t/escaping-backslashes-in-ci-output/7354 "2023-05-19T13:34:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![k3tchup](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/k3tchup/32/2162_2.png) [@k3tchup](https://www.finalbuilder.com/forums/u/k3tchup)\
**Post date:** [May 19, 2023, 1:34pm UTC](https://www.finalbuilder.com/forums/t/escaping-backslashes-in-ci-output/7354/1 "2023-05-19T13:34:32Z")

</div>

I have problem with outputting network path as log messages and as comments.

`\\serverHostname\data\output\master`  
Outputted to comment or log message look like this → `\serverHostname\data\output\master`

`\\serverHostname\data\output\release\branch`  
Outputted to comment or log message look like this → `\serverHostname\data\output elease\branch`

So 2 backslashes are escaped to one, and \r is escaped to return carriage ?

When I escape `\\ `with `\\\\`, the output is `\\\\` 😃  
When I escape `\r` with `\\r`, the output is `\release` 😃

---

<div class="post-metadata">

**Author:** ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)\
**Post date:** [May 21, 2023, 12:22pm UTC](https://www.finalbuilder.com/forums/t/escaping-backslashes-in-ci-output/7354/2 "2023-05-21T12:22:17Z")

</div>

Hi Michal,

What action or code are you using to output the log messages and comments?

No escaping is required when using the Log Entry action:

 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/2/2bb83cbce5df37533b6978aec9f48774180c0cbb.png)

Log output:

 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/c/c6d5d5f6fa0dcebc2c3dfd02156c17625b98835a.png)

Comment output:  
 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/3/3a258d047ac4d79cb9345c53c4c93af977669406.png)

---

<div class="post-metadata">

**Author:** ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)\
**Post date:** [May 21, 2023, 11:44pm UTC](https://www.finalbuilder.com/forums/t/escaping-backslashes-in-ci-output/7354/3 "2023-05-21T23:44:16Z")

</div>

From your previous posts, I’m guessing that you are outputting the log messages and comments from a Powershell script. In this case, you do have to escape all backslashes. e.g.

```auto
write-Host "@@continua[message value='\\\\serverHostname\\data\\output\\master' status='information']"
write-Host "@@continua[message value='\\\\serverHostname\\data\\output\\release\\branch' status='information']"

write-Host "@@continua[addBuildComment comment='\\\\serverHostname\\data\\output\\master']"
write-Host "@@continua[addBuildComment comment='\\\\serverHostname\\data\\output\\release\\branch']"

```

This outputs the following to the log:  
 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/5/5b78f85ca26ef7c96c33fb6de6ddaa013a0735bb.png)

And the following comments:  
 ![image](https://www.finalbuilder.com/forums/uploads/default/original/2X/4/4f550dd30063795ade2fffbe621d13a62342b607.png)

See [Custom Log Messages](https://wiki.finalbuilder.com/display/continua/Custom+Log+Messages#:~:text=newlines%2C%20blackslashes%2C%20%5B%20%5D%20and%20single%20quotes%20must%20be%20escaped).
