Jump to page content

Technical notes

Contents

Colour command prompts

Command Prompt

Set the PROMPT environment variable to: $E[1;34;40m$p$E[0m$g

This puts the path in blue. To also add a timestamp in pale yellow, use: $E[1;33;40m$T $E[1;34;40m$p$E[0;37;40m$g

Unfortunately there is no way to have the timestamp without centiseconds.

PowerShell

Put the following function into the file specified by $profile, creating the file if necessary:

function prompt  
{  
    $ESC = [char]27
    "PS $ESC[1;34;40m$($executionContext.SessionState.Path.CurrentLocation)$ESC[0m$('>' * ($nestedPromptLevel + 1)) "  
}