Skip to content
Add coloring to the output of Get-ChildItem Cmdlet of PowerShell.
Branch: develop
Clone or download
Latest commit 207f2c8 May 15, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
screenshots Update README and screentshot Apr 25, 2017
.gitignore Add devel Jan 21, 2018
Get-ChildItemColor.psm1 Beautify code Jan 21, 2018
LICENSE Create LICENSE May 15, 2018 Improve and update README Jan 21, 2018


  • This adds colors to the output of Get-ChildItem Cmdlet of PowerShell. It is based on Tim Johnson’s script and another script by the PowerShell Guy.
  • Before version 1.0.0, the script actually had used Write-Host to write colored items on console. Now it just changes $Host.UI.RawUI.ForegroundColor and keep the item object intact. Hence, now one can use pipeline. (e.g., ~Get-ChildItemColor | grep “.git”~).
  • Get-ChildItemColorFormatWide still uses Write-Host for output however. This is because Get-ChildItemColor | Format-Wide does not allow multiple colors in one line. Hence, pipeline does not work with Get-ChildItemColorFormatWide.




Get-ChildItemColorFormatWide (ls equivalent)


Notes on the code

  • It uses a hash table instead of regular expressions to specify colors
  • Recognize the DictionaryEntry case (e.g., Get-ChildItemColor env:)
  • Color support for | Format-Wide format (ls equivalent) with custom script


Install from PowerShellGallery

PowerShellGet is required, which is included in Windows 10 and WMF5. If you are using PowerShell V3 or V4, you will need to install PowerShellGet.

Then, you can simply run Install-Module Get-ChildItemColor (or Install-Module Get-ChildItemColor -Scope CurrentUser).

Install from GitHub

Clone the repo in your PowerShell Module folder ($ENV:UserProfile\Documents\WindowsPowerShell\Modules).

git clone


When you import the module:

Import-Module Get-ChildItemColor

it exposes two functions, Get-ChildItemColor and Get-ChildItemColorFormatWide.

You can add aliases to these functions for convenience. For example, I have the following in my profile[fn:pathProfile] (please do not put this into ISE profile[fn:pathProfileISE] as it does not work in ISE):

#verify this is the console and not the ISE
Import-Module Get-ChildItemColor

Set-Alias l Get-ChildItemColor -option AllScope
Set-Alias ls Get-ChildItemColorFormatWide -option AllScope

So l yields colored output of Get-ChildItem and ls yields colored output of Get-ChildItem | Format-Wide equivalent.

[fn:pathProfile] $Home\[My ]Documents\WindowsPowerShell\Profile.ps1

[fn:pathProfileISE] $Home\[My ]Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1




  • Improve README (#15)
  • Beautify code


  • PR #13: Fallback to Gray when no OriginalForegroundColor (thanks to mikesigs)
  • PR #12: Fix a typo (thanks to jqly)


  • Robust to non-file entries (Issue #10)


  • Revert back to previous implementation of Get-ChildItemColorFormatWide


  • The script changes $Host.UI.RawUI.ForegroundColor only and keep the item object intact
  • Get-ChildItemColorFormatWide is basically Get-ChildItemColor | Format-Wide


  • Better performance by reducing if’s
  • Proper printing of DirectoryEntry for FormatWide case


  • Published on PowerShellGallery
  • Refactoring; separate out two functions


  • Make it a PowerShell module


  • Returns vanila Get-Childitem results for DictionaryEntry cases.


  • Make function names consistent to the PowerShell naming convention (#8)
  • Use parameters more consistently, -Path works with paths with spaces (#3), and -Force works (#9)
You can’t perform that action at this time.