Colorize Get-Childitem Output
- From: "Tom G." <Tom.Glowacki@xxxxxxxxxxx>
- Date: 1 Jan 2006 13:54:19 -0800
I'm working on a function that will colorize the get-childitem output
based upon file extension, similar to what can be done with the ls
command in Linux. However, the issue I'm running into is that after
sending the get-childitem object down the pipe, I only get the file
names or directory names returned rather than the full output from the
get-childitem cmdlet. Among the variations I've tried include the
following (no extension checking is being done):
1) get-childitem | foreach-object {write-host -ForegroundColor "yellow"
$_}
2) write-host -ForegroundColor "yellow" $(get-childitem)
It seems that the write-host cmdlet is stripping the object of all
properties except the name property. Can anyone explain how the
write-host command affects an object that is passed to it and/or point
me in the right direction as to how to get the full get-childitem
output in color?
.
- Follow-Ups:
- Re: Colorize Get-Childitem Output
- From: Keith Hill
- Re: Colorize Get-Childitem Output
- Next by Date: Re: Colorize Get-Childitem Output
- Next by thread: Re: Colorize Get-Childitem Output
- Index(es):