Create a gist now

Instantly share code, notes, and snippets.

my custom powershell prompt
# open your profile.ps1 and paste this in
# easiest way:
# > youreditorprogram.exe $profile
function Prompt {
$path = $(Get-Location).Path
if ($path.StartsWith($HOME, "CurrentCultureIgnoreCase")) {
$path = "~"+ $path.Substring($HOME.Length)
}
$time = $(Get-Date -Format t)
Write-Host "`n🌈[$time] [" -NoNewline
Write-Host $path -NoNewline -Foreground blue
Write-Host "]"
return "$ ";
}
# usage: > . $Reload-Profile
function Reload-Profile {
@(
$Profile.AllUsersAllHosts,
$Profile.AllUsersCurrentHost,
$Profile.CurrentUserAllHosts,
$Profile.CurrentUserCurrentHost
) | % {
if(Test-Path $_){
Write-Verbose "Running $_"
. $_
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment