PowerShell PowerTip: Customizing your prompt

Kory Thacher

I’ve been taking a break from the blog for a while due to some personal reasons, but I had a few people ask me about my PowerShell prompt recently.
I like extra horizontal space, so I removed the path from the prompt and put it in the window title bar. I also just display the current time in the prompt itself.
You can customize your prompt by using your profile and overriding the “Prompt” function.
A coworker of mine, Tony Radkiewicz, used a similar prompt and I really liked it so I’ve been using it since.
function prompt 
$Time = (Get-Date).ToString("hh:mm") 
$host.ui.rawui.WindowTitle = (Get-Location)
"$Time> "
That’s all for now, I’ll try to get some more tips out as I have time!


Discussion is closed.

Feedback usabilla icon