I wanted a good visible Prompt with a shortend Path for common working directories. It consists now on the parts Historynumber of the current command, End of last command Time, the shortend path and a > Sign. Every Part is colored differently. The Full Path is shown in Title. Global foreground color is reset to white.

Feel free to use and modifiy it:

# prompt
function prompt {
 $host.ui.rawui.windowtitle = "PowerShell - "+ (Get-Location).ToString()
 $host.ui.rawui.foregroundcolor = "White"
 $private:history = @(get-history)
 if ($private:history.count -eq 0) {
  $private:intCommandCount = 1
 } else {
  $private:intCommandCount = $private:history[$private:history.count - 1].ID +1
 }
 $private:location = @((Get-Location).ToString().replace($home, "~").replace("C:\entwicklung\","~"))

Write-Host -NoNewline -ForeGroundColor Yellow ("[$private:intCommandCount] ")
 Write-Host -NoNewline -ForeGroundColor Gray @(Get-Date -format "HH:mm:ss " )
 Write-Host -NoNewline -ForeGroundColor Yellow $private:location
" > "
}

Advertisements