title: Running an EXE file using PowerShell from a directory with spaces in it
body: <p>I'm trying to run MSTest.exe from <code>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE</code>. What's more, I'm taking all of the assemblies in my current directory and setting them as separate /testcontainer arguments. I cannot figure out how to do this without PowerShell complaining.</p>
  
  <pre><code>$CurrentDirectory = [IO.Directory]::GetCurrentDirectory()
  
  $MSTestCall = '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"'
  
  foreach($file in Get-ChildItem $CurrentDirectory) 
  {
      if($file.name -match "\S+test\S?.dll$" )
      {
          $MSTestArguments += "/TestContainer:" + $file + " "
      }
  }
  
  $MSTestArguments += " /resultsFile:out.trx"
  $MSTestArguments += " /testsettings:C:\someDirectory\local64.testsettings"
  
  Invoke-Expression "$MSTestCall $MSTestArguments"
  </code></pre>
  
  <p>The error I get from this code is:</p>
  
  <blockquote>
    <p>Invoke-Expression : You must provide a value expression on the right-hand side of the '/' operator.</p>
  </blockquote>
  
  <p>I don't get this error when I try to call a mstest.exe in a directory without a space in the name (no additional "'s are needed).</p>
  
  <p>When I try using <code>&amp;</code>,</p>
  
  <pre><code>&amp;$MSTestCall $MSTestArguments
  </code></pre>
  
  <p>It hands $MSTestArguments over as a single argument, which MSTest prompty throws out. Suggestions?</p>