title: How to suppress quotes in PowerShell commands to executables
body: <p>Is there a way to suppress the enclosing quotation marks around each command-line argument that PowerShell likes to generate and then pass to external executables for command-line arguments that have spaces in them?</p>
  
  <p>Here's the situation:</p>
  
  <p>One way to unpack many installers is a command of the form:</p>
  
  <pre><code>msiexec /a &lt;packagename&gt; /qn TARGETDIR="&lt;path to folder with spaces&gt;"
  </code></pre>
  
  <p>Trying to execute this from PowerShell has proven quite difficult. PowerShell likes to enclose parameters with spaces in double-quotes. The following lines:</p>
  
  <pre><code>msiexec /a somepackage.msi /qn 'TARGETDIR="c:\some path"'
  
  msiexec /a somepackage.msi /qn $('TARGETDIR="c:\some path"')
  
  $td = '"c:\some path"'
  
  msiexec /a somepackage.msi /qn TARGETDIR=$td
  </code></pre>
  
  <p>All result in the following command line (as reported by the Win32 GetCommandLine() API):</p>
  
  <pre><code>"msiexec" /a somepackage.msi /qn "TARGETDIR="c:\some path""
  </code></pre>
  
  <p>This command line:</p>
  
  <pre><code>msiexec /a somepackage.msi TARGETDIR="c:\some path" /qn
  </code></pre>
  
  <p>results in</p>
  
  <pre><code>"msiexec" /a fooinstaller.msi "TARGETDIR=c:\some path" /qn
  </code></pre>
  
  <p>It seems that PowerShell likes to enclose the results of expressions meant to represent one argument in quotation marks when passing them to external executables. This works fine for most executables. However, MsiExec is very specific about the quoting rules it wants and won't accept any of the command lines PowerShell generates for paths have have spaces in them.</p>
  
  <p>Is there a way to suppress this behavior?</p>