Skip to content

Add coloring to the output of `Get-ChildItem` Cmdlet of PowerShell.

Notifications You must be signed in to change notification settings

rvdnieuwendijk/Get-ChildItem-Color

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 

Repository files navigation

Get-ChildItem-Color

Add coloring to the output of Get-ChildItem Cmdlet of PowerShell. In addition to the original functionality, this provides:

  • Better performance by using Dictionary objects instead of regular expressions
  • Color support for Format-Wide case (ls equivalent)
  • Automatically compute number of columns for Format-Wide case (thanks to Guillaume Collic)

Install

git clone https://github.com/joonro/Get-ChildItem-Color.git

It is convenient to do this in your $PROFILE [1] folder.

Usage

In your $PROFILE, add the following:

. "Path\To\Get-ChildItem-Color\Get-ChildItem-Color.ps1"

Set-Alias l Get-ChildItem-Color -option AllScope
Set-Alias ls Get-ChildItem-Format-Wide -option AllScope

If you install it under the $PROFILE folder, you can also do the following:

$ScriptPath = Split-Path -parent $PSCommandPath
. "$ScriptPath\Get-ChildItem-Color\Get-ChildItem-Color.ps1"

Set-Alias l Get-ChildItem-Color -option AllScope
Set-Alias ls Get-ChildItem-Format-Wide -option AllScope

Authors

Joon Ro

This code is based on Tim Johnson's script and also Keith Hill's answer at this Stack Overflow question.

Footnotes

[1]C:\Users\username\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

About

Add coloring to the output of `Get-ChildItem` Cmdlet of PowerShell.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PowerShell 100.0%