My prompt() for PowerShell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function prompt
{
$private:h = @(Get-History)
$private:nextCommand = $private:h[$private:h.Count - 1].Id + 1
$currenttime = "["+(get-date).hour+":"+(get-date).minute.tostring("D2")+"]"
$PathDriver = (get-location).provider.tostring().split("\")[-1]
$currentpath = (get-location).providerpath
Write-Host -NoNewline -ForeGroundColor Yellow [^_^]
Write-Host -NoNewline -ForeGroundColor White $currenttime
Write-Host -NoNewline -ForeGroundColor Yellow ""[$PathDriver][
foreach ($StackPath in (Get-Location -Stack))
{
Write-Host -NoNewLine -ForeGroundColor Yellow +
}
Write-Host -ForeGroundColor Yellow $currentpath]
Write-Host -NoNewline -ForeGroundColor Cyan [$private:nextCommand]
return ">"
}