PowerShell Prompt

I used to maintain the "Bash Prompt HOWTO," so whenever I see a new shell I feel compelled to modify the prompt.

Place this in the C:\Users\<username>\Documents\WindowsPowerShell\profile.ps1 file (at least that appears to be it for Windows 10):

function prompt
{
    Write-Host ($(Get-Location)) -ForegroundColor Yellow -nonewline
    Write-Host (" PS>") -ForegroundColor White -BackgroundColor DarkBlue -nonewline
    return " "
}

I must admit I don't know why the return " " is required (I don't understand PS that well yet). I thought I'd remove it and the last -nonewline and it would work, but it didn't.

Caveat: Our work computers don't allow running PowerShell scripts, so I have to cut-and-paste (that that is allowed is very humorous ...). So I've never actually run it from its proper location. I don't use Windows at home.

My source for this was https://mshforfun.blogspot.com/2006/05/perfect-prompt-for-windows-powershell.html (thanks for referencing me!).

photo: The resulting pretty colours prompt

showing the code pasted into the prompt, which goes from monochrome to fairly colourful