Hacker News new | past | comments | ask | show | jobs | submit login

ls is an alias for Get-ChildItem. However, grep is the native command in this case. While such things work to some extent, it has the problem of turning your objects into plain strings. Effectively the same as if you had run

    (ls | % Name) -match '_'
The fact that the file's name is its default string conversion can be pretty annoying when dealing with results, e.g. from gci -recurse where it's quiet important to retain the path to the file. So, careful with such things. On Stack Overflow I tend to scold people who reduce PowerShell objects to strings without good reason ;-)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: