Make Windows PowerShell prompt look colorful like Ubuntu


As someone who has enjoyed the bash terminal on Ubuntu for years as a student, transitioning to the bland looking PowerShell on Windows at work was a subpar experience for me. All that white makes it hard to distinguish one command run from the other one when you're firing dozens of commands in a day.

Here's how to paint some colors on that terminal prompt to make it look similar to the bash terminal on Ubuntu. Open a PowerShell window and run the below command/function.

function Prompt {
  $promptString = "PS "
  Write-Host $promptString -NoNewline -ForegroundColor Green
  Write-Host $(Get-Location) -NoNewline -ForegroundColor DarkCyan
  Write-Host "$" -NoNewline -ForegroundColor White
  return " "
}

This will change the PowerShell prompt to look like the one shown in the screenshot below.

PowerShell

You can modify the above function to change the colors as per your preference. The full list of colors supported by the Write-Host utility is available in Microsoft PowerShell Docs.

Have questions? Discuss on Twitter

Last Updated -