title: Spaces in path are giving me an aneurysm
body: <p>Running Window&nbsp;7 64-bit with PowerShell 4.0.  I'm having problems getting PowerShell's <code>Test-Path</code> and <code>New-Item</code> cmdlets to work for my path name, which has embedded spaces.  I've run several Google searches which pointed to several similar StackOverflow entries, and most (<a href="https://stackoverflow.com/questions/28269523/how-to-handle-spaces-in-file-path">like this one</a>) refer to wrapping the path name in quotes - double quotes if the path includes variables to be interpreted, as mine does - which I've done.  Doesn't seem like it should be that difficult, and I'm sure I'm overlooking something obvious, but nothing jumps out.</p>
  
  <p>Here's the code fragment giving me grief - <code>$mnemonic</code> is part of a long parameter list that I shortened for brevity.</p>
  
  <pre class="lang-cs prettyprint-override"><code>Param(
      [string]$mnemonic = 'JXW29'
  )
  
  $logdir = "T:\$$PowerShell Scripts\logs\STVXYZ\$mnemonic\"
  
  if ((Test-Path "$logdir") -eq $false)
  #if ((Test-Path 'T:\$$PowerShell Scripts\logs\STVXYZ\JXW29\') -eq $false)
      New-Item -Path "$logdir" -ItemType Directory
      #New-Item -Path 'T:\$$PowerShell Scripts\logs\STVXYZ\JXW29' -ItemType Directory
  </code></pre>
  
  <p>Even though the last node in the directory does not exist, the <code>Test-Path</code> check returns true and my code blows right past the <code>New-Item</code> that should have created it. There are statements further down in the rest of the script that write to that directory that do not fail - no idea where they're really writing to.</p>
  
  <p>If I uncomment and run the commented code, which which uses a literal string for the path instead of one with variables, everything works. First time through, the STVXYZ folder is not found and is created.  Second time through, it's detected and the New-Item is skipped.</p>