Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 1.67 KB

README.rst

File metadata and controls

61 lines (40 loc) · 1.67 KB

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