title: PowerShell Split after Pipe
body: <p>I use the following line in my script to return all the paths of all folders at the <code>$folder</code> location.</p>
  
  <pre><code>dir -recurse $folder|?{$_.PSIsContainer}|select -ExpandProperty FullName
  </code></pre>
  
  <p>This works. But: I only need the fourth element of each path.</p>
  
  <p>I've tried adding <code>|{$_.Split("\")}[3]}</code>with the <code>[3]</code> in various places but I am getting an error with the split command, that <code>Expressions are only allowed as the first element of a pipeline.</code></p>
  
  <p>I've tried putting brackets around various sections, and putting the whole expression into brackets and into a split but I can't seem to find a way to attach the split to any part of the pipe... Is there another way, perhaps?</p>