Skip to content

Instantly share code, notes, and snippets.

@nirlanka
Last active June 2, 2017 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nirlanka/63b319d99a12e12de8b95e14e442757c to your computer and use it in GitHub Desktop.
Save nirlanka/63b319d99a12e12de8b95e14e442757c to your computer and use it in GitHub Desktop.
Cooler PowerShell Prompt (code for blog article)
Clear-Host
new-item alias:np -value C:\Windows\System32\notepad.exe
new-item -itemtype file -path $profile -force
notepad $PROFILE
$Shell = $Host.UI.RawUI
$size = $Shell.WindowSize
$size.width=70
$size.height=25
$Shell.WindowSize = $size
$size = $Shell.BufferSize
$size.width=70
$size.height=5000
$Shell.BufferSize = $size
$shell.BackgroundColor = “Gray”
$shell.ForegroundColor = “Black”
set-location e:\dev
function Prompt
{
$id = 1
$historyItem = Get-History -Count 1
if($historyItem)
{
$id = $historyItem.Id + 1
}
Write-Host -ForegroundColor Green -NoNewLine "$id "
Write-Host -ForegroundColor Gray -NoNewLine "$(Get-Location) "
$host.UI.RawUI.WindowTitle = "PS $(Get-Location)"
"$ "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment