| 7.15. Colorize the Output of get-childitemUse a filter to colorize the output of a file listing. Customize the coloring rules by modifying the hashtable or changing the logic in the filter to color by something different.      $colors=@{msh = "Red"; exe = "Green"; cmd = "Green"; directory = "Blue" }     $defaultColor = "Gray"     filter color-files {         if ($_.Extension -ne "") { $ext = $_.Extension.Substring(1) }         if ($_.Mode.StartsWith("d")) { $ext = "directory" }         if ($colors.ContainsKey($ext)) { $color = $colors[$ext] }         else { $color = $defaultColor }         write-host -ForegroundColor $color $_     }After dot sourcing the script, use it in the pipeline after get-childitem to bring color to the console: MSH> get-childitem | color-files Figure 7-1 shows the result. |