Skip to content

Instantly share code, notes, and snippets.

@KallDrexx
Last active May 27, 2023 15:51
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 KallDrexx/8144f6677cb4165ca705934403c8c0f1 to your computer and use it in GitHub Desktop.
Save KallDrexx/8144f6677cb4165ca705934403c8c0f1 to your computer and use it in GitHub Desktop.
Personal Powershell Profile
Set-PSReadlineKeyHandler -Key Tab -Function Complete
Set-PSReadLineOption -BellStyle None
function Prompt() {
$pathParts = (Get-Location).Path -Split '\\'
$prompt = "PS "
if ($pathParts.Length -ge 1) {
$prompt += "$($pathParts[0])\"
}
if ($pathParts.Length -eq 2) {
$prompt += "$($pathParts[1])"
} elseif ($pathParts.Length -eq 3) {
$prompt += "$($pathParts[1])\$($pathParts[2])"
} else {
$length = $pathParts.Length
$prompt += "..\$($pathParts[$length - 2])\$($pathParts[$length - 1])"
}
"$prompt> "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment