# Variables to powershell should be escaped

**URL:** https://www.finalbuilder.com/forums/t/variables-to-powershell-should-be-escaped/5918
**Category:** Bugs
**Created:** [August 1, 2014, 4:31am UTC](https://www.finalbuilder.com/forums/t/variables-to-powershell-should-be-escaped/5918 "2014-08-01T04:31:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![catenalogic](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/catenalogic/32/116_2.png) [@catenalogic](https://www.finalbuilder.com/forums/u/catenalogic)
#### Post date: [August 1, 2014, 4:31am UTC](https://www.finalbuilder.com/forums/t/variables-to-powershell-should-be-escaped/5918/1 "2014-08-01T04:31:50Z")

</div>

When using a simple powershell script, I have an issue passing in a path as a variable:  
  
Parameters  
Working Directory: C:\CI\_WS\Ws\1912\Source\MyProject\deployment&nbsp;  
Executable: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe  
Arguments: -NonInteractive -Command "try { invoke-expression -Command ‘C:\CI\_WS\Ws\1912\Source\MyProject\deployment\updateversion.ps1 xml= **C:\CI\_WS\Ws\1912\Source\MyProject\src\MyProject.Windows\Package.appxmanifest** version=’; exit $lastexitcode } catch { $Error[0]; exit 1}"  
Exception calling “Load” with “1” argument(s): “The given path’s format is not supported.”&nbsp;  
At C:\CI\_WS\Ws\1912\Source\MyProject\deployment\updateversion.ps1:7 char:1  
+ $doc.Load($xmlPath)  
+ ~~~~~~~~~~~~~~~~~~~  
+ CategoryInfo : NotSpecified: (I think the path should be escaped (but it’s a variable in my configuration). Maybe you can add a $Utils.EscapePath$ method?

---

<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: [August 4, 2014, 3:29am UTC](https://www.finalbuilder.com/forums/t/variables-to-powershell-should-be-escaped/5918/2 "2014-08-04T03:29:38Z")

</div>

Hi Geert,  
  
The powershell arguments are specified as **-param1 value1&nbsp;-param2 value2**  
  
e.g.

`-xml C:\CI_WS\Ws\1912\Source\MyProject\src\MyProject.Windows\Package.appxmanifest -version ""`

  
or using variables  

`-xml “%xmlPath%” -version "%version%"`

  
I’d add some text to the field description to make this clearer

---

<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: [August 4, 2014, 3:33am UTC](https://www.finalbuilder.com/forums/t/variables-to-powershell-should-be-escaped/5918/3 "2014-08-04T03:33:21Z")

</div>

… and update the placeholder text!

---

<div class="post-metadata">

### Author: ![catenalogic](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/catenalogic/32/116_2.png) [@catenalogic](https://www.finalbuilder.com/forums/u/catenalogic)
#### Post date: [August 5, 2014, 9:10am UTC](https://www.finalbuilder.com/forums/t/variables-to-powershell-should-be-escaped/5918/4 "2014-08-05T09:10:29Z")

</div>

Thanks. Because I used the placeholder example, it went wrong. Now it’s all working fine, thanks.
