title: Powershell odd behavior with Get-ChildItem and wildcard in path
body: <p>Windows 8.1 Enterprise</p>
  
  <pre><code>    $PSVersionTable.PSVersion
      Major  Minor  Build  Revision
      -----  -----  -----  --------
      4      0      -1     -1
  </code></pre>
  
  <p>Here's what I'm seeing. I have a file "commands2.txt" in a subdirectory "level2".  For simplicity it is the only file in the "testing" structure. 
  Full path c:\users\chris\testing\level2\commands2.txt</p>
  
  <p>Setup
  from c:\users\chris\testing as current directory.</p>
  
  <pre><code>    $stuff  = gci c:\users\chris\testing\ -Recurse command*.txt
      $stuff2 = gci c:\users\chris\testing\* -Recurse command*.txt
  </code></pre>
  
  <p>So now,</p>
  
  <pre><code>    get-item $stuff 
  </code></pre>
  
  <p>returns "get-item : Cannot find path 'C:\Users\chris\testing\commands2.txt' because it does not exist."  Note that "level2" is missing. Its looks like its just appending .Name to the current path.</p>
  
  <p>But</p>
  
  <pre><code>    get-item $stuff2 
  </code></pre>
  
  <p>Returns expected results of a get-item of a fullpath file.</p>
  
  <p>Odd right? So here's where I get confused.</p>
  
  <pre><code>    Compare-Object $stuff $stuff2
  </code></pre>
  
  <p>Shows that they are different.</p>
  
  <pre><code>    InputObject                                                 SideIndicator
      -----------                                                 -------------
      C:\users\chris\testing\level2\commands2.txt                 =&gt;
      commands2.txt                                               &lt;=
  </code></pre>
  
  <p>But:</p>
  
  <pre><code>    $a = $stuff | select *
      $b = $stuff2 | select *
      compare-object $a $b -includeEqual
  </code></pre>
  
  <p>Shows that they are the same.
  I know I can work around this by putting the "*" in the path.</p>
  
  <p>But why are the variables different, and how can I tell? </p>
  
  <p>Why is the InputObject different?</p>
  
  <p>Is there a way to see the difference between the two variables $stuff and $stuff2?</p>
  
  <p>Update: Vesper basically nailed it.  Searching here with get-childitem and tostring returned helpful questions. Mine appears to be a variation of a few others.  <a href="https://stackoverflow.com/questions/2744047/mysterious-different-conversion-to-string-of-seemingly-same-input-data/2744637#answer-2744637">Mysterious different conversion to string[] of seemingly same input data</a> shows whats going on. In addition there is a bug report from 2010 here :<a href="https://connect.microsoft.com/PowerShell/feedback/details/556004/get-childitem-gets-fileinfo-constructed-in-different-ways-depending-on-parameters" rel="nofollow noreferrer">https://connect.microsoft.com/PowerShell/feedback/details/556004/get-childitem-gets-fileinfo-constructed-in-different-ways-depending-on-parameters</a>
  based on that previous link. Good times.</p>