Last active
May 27, 2023 15:51
-
-
Save KallDrexx/8144f6677cb4165ca705934403c8c0f1 to your computer and use it in GitHub Desktop.
Personal Powershell Profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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