Friday 5 March 2010

My PowerShell prompt

Just wanted to share it :)

function prompt
{
  $_locationStackDepthString = New-Object string ([char] '+'), (Get-Location -Stack).Count


  $color = 'Yellow'

  Write-Host '>> ' -nonewline -ForegroundColor $color
  Write-Host $(Get-Date -Format T) -ForegroundColor 'Green' -NoNewLine
  Write-Host " " $PWD.Path -ForegroundColor 'Cyan'
  Write-Host ($_locationStackDepthString + '>') -nonewline -ForegroundColor $color


  return " "
}




It shows current time, folder, uses a separate line for commands and displays current depth of pushd/popd commands (I use them rather intensively).

No comments: