# &#91;1.7.0.108&#93; Powerhsell action does not escape brackets in expanded variable arguments

**URL:** https://www.finalbuilder.com/forums/t/91-1-7-0-108-93-powerhsell-action-does-not-escape-brackets-in-expanded-variable-arguments/5998
**Category:** Bugs
**Created:** [September 29, 2015, 1:40am UTC](https://www.finalbuilder.com/forums/t/91-1-7-0-108-93-powerhsell-action-does-not-escape-brackets-in-expanded-variable-arguments/5998 "2015-09-29T01:40:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![skermajo](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@skermajo](https://www.finalbuilder.com/forums/u/skermajo)
#### Post date: [September 29, 2015, 1:40am UTC](https://www.finalbuilder.com/forums/t/91-1-7-0-108-93-powerhsell-action-does-not-escape-brackets-in-expanded-variable-arguments/5998/1 "2015-09-29T01:40:42Z")

</div>

When trying to pass agent paths (via query syntax) that contain 'Program Files (x86)' to powershell scripts, I receive the following error:  
  
x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the&nbsp;spelling of the name, or if a path was included, verify that the path is correct and try again.  
  
It turns out this is because the brackets surrounding x86 are not escaped.&nbsp;To reproduce, I used the following arguments in a powershell action as script arguments, resulting in the error above.  
  
&nbsp;-badarg '$Agent.MSBuild.12.0.PathX86$'  
  
This expanded to:

-badarg 'C:\Program Files (x86)\MSBuild\12.0\bin\'  
  
When it should probably be escaping the brackets with back ticks?  
  
-badarg 'C:\Program Files `(x86`)\MSBuild\12.0\bin\'  
  
If I enter the path manually (without variable expansion) and use the back-ticks, it works as expected.

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 29, 2015, 2:31am UTC](https://www.finalbuilder.com/forums/t/91-1-7-0-108-93-powerhsell-action-does-not-escape-brackets-in-expanded-variable-arguments/5998/2 "2015-09-29T02:31:42Z")

</div>

Hi Joel   
  
 The issue here is that the variable expansion is done by code that knows nothing about powershell. We’ll have to have a think about what can be done here.

---

<div class="post-metadata">

### Author: ![skermajo](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@skermajo](https://www.finalbuilder.com/forums/u/skermajo)
#### Post date: [October 23, 2015, 4:35am UTC](https://www.finalbuilder.com/forums/t/91-1-7-0-108-93-powerhsell-action-does-not-escape-brackets-in-expanded-variable-arguments/5998/3 "2015-10-23T04:35:29Z")

</div>

Confirming as fixed in 1.7.1 - also had to change all quotes to single quotes in the argument parameters, but after that it all worked well. The action is a LOT easier to use now! Cheers for the fast solution.
