Created
February 9, 2012 03:09
-
-
Save isa/1776924 to your computer and use it in GitHub Desktop.
Powershell Awkwardness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\>$files = (gci -Recurse | Where { $_.Name -eq "some.file" } | |
C:\>$files.Length # prints 45 | |
C:\>$files | %{ $_.FullName } # displays each file name properly | |
C:\>$files | %{ Get-Content $_ } # prints the first file content 45 times WTF? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works as it is supposed.
Check if your $files is messed-up, or try opening powershell with -noprofile and check if the results are repeated.