# Variable (for Windows/Powershell) that contains a character which must by escaped?

**URL:** <https://forum.ansible.com/t/variable-for-windows-powershell-that-contains-a-character-which-must-by-escaped/22231>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [August 8, 2016, 12:38am UTC](https://forum.ansible.com/t/variable-for-windows-powershell-that-contains-a-character-which-must-by-escaped/22231 "2016-08-08T00:38:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Gagliardi](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@Matt\_Gagliardi](https://forum.ansible.com/u/Matt_Gagliardi)\
**Post date:** [August 8, 2016, 12:38am UTC](https://forum.ansible.com/t/variable-for-windows-powershell-that-contains-a-character-which-must-by-escaped/22231/1 "2016-08-08T00:38:47Z")

</div>

I searched around but didn’t see anything that appeared to apply to the Windows/Powershell application I need advice on. I’ve got a playbook that works 100% fine _as long as a certain variable doesn’t contain a “$” character_. I realize the issue is that Powershell is interpreting that and dropping the “$” and everything after it. Is there any way to escape a variable such that it’ll be interpreted simply as a string? Right now what I’m doing is using the raw module and the command looks like this:

raw: ‘echo some information here: {{ variable1 }} \ {{ variable2 }} {{ variable3 }} \> C:\test.txt’

Let’s say it’s the second variable that should be Test$123…what I’m getting output to that file is simply Test. I’ve tried adjusting quote position and type (single vs. double, etc.) and I’m guessing I just haven’t hit on the right combination…but I’d really appreciate any help.

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [August 8, 2016, 5:52pm UTC](https://forum.ansible.com/t/variable-for-windows-powershell-that-contains-a-character-which-must-by-escaped/22231/2 "2016-08-08T17:52:06Z")

</div>

Tried the stop-parsing symbol ( --% )? [https://technet.microsoft.com/en-us/library/hh847892.aspx](https://technet.microsoft.com/en-us/library/hh847892.aspx)
