title: How do I pass a string parameter to Powershell for ConvertFrom-StringData from command line?
body: <p>I'm having trouble running powershell with a script that should use a variable number of parameters.</p>
  
  <p>The script file looks like this:</p>
  
  <pre><code>param( [string]$paramString )
  
  $params = ConvertFrom-StringData $paramString
  $params
  </code></pre>
  
  <p>Running the script directly in powershell yields the expected result:</p>
  
  <pre><code>[PS] C:\some\path&gt;.\test.ps1 "a=foo `n b=bar `n c=moo"
  
  Name                           Value
  ----                           -----
  c                              moo
  a                              foo
  b                              bar
  </code></pre>
  
  <p>Calling powershell from the command line with the same script and parameters shows this:</p>
  
  <pre><code>C:\some\path&gt;powershell -nologo -file ./test.ps1 "a=foo `n b=bar `n c=moo"
  
  Name                           Value
  ----                           -----
  a                              foo `n b=bar `n c=moo
  </code></pre>
  
  <p>It seems like the passed string is in some format so the <code>ConvertFrom-StringData</code> function is unable to parse it anymore.</p>