title: PowerShell Invoke-Expression command parameter contains comma
body: <p>What should I do when a password contains PowerShell special characters?</p>
  
  <pre><code>Invoke-Expression -Command "net use x: $Path /USER:domain1\user1 7Ui4RT,@T /persistent:no"
  </code></pre>
  
  <p>This fails on syntax -- because PowerShell interprets <code>7Ui4RT,@T</code> as an array:</p>
  
  <pre><code>Invoke-Expression -Command "net use x: $Path /USER:domain1\user1 7Ui4RT`,@T /persistent:no"
  </code></pre>
  
  <p>This fails on syntax -- apparently because PowerShell can't interpret <code>7Ui4RT``,@T</code></p>
  
  <pre><code>Invoke-Expression -Command "net use x: $Path /USER:domain1\user1 "7Ui4RT,@T" /persistent:no"
  </code></pre>
  
  <p>This fails because PowerShell interprets <code>7Ui4RT,@T</code> as an object, not a string (error = "A positional parameter cannot be found that accepts argument 'System.Object[]'.").</p>
  
  <p>What should I do?</p>