Sunday, December 31, 2006

PowerShell Colours

The default colour scheme for PowerShell RTM relies on the defaults for cmd.exe, namely white text on background, and a relatively small window. I prefer to change the defaults in my profile.ps1 file as follows:

# set standard colours etc
$host.ui.rawui.WindowTitle = "PowerShell Rocks!!!"
# error and warning colours
$host.privatedata.errorforegroundcolor="white" $host.privatedata.warningbackgroundcolor="white"

As you can see, you set the basic colours with $host.ui.rawui properties, but set the error/warning colours using $host.privatedata properties. If you want to see what the colours look like for errors or warnings, you can use write-warning and write-error cmdlets as shown in this screenshot:


1 comment:

PReetamZ said...

Thank you for helping in getting rid of Red color, Everytime I try something, red color keeps bugging me and then without reason I keep using cls, every 1 min...hahaha..