Created
June 3, 2011 05:32
-
-
Save Ang3lFir3/1005916 to your computer and use it in GitHub Desktop.
a collapsing powershell prompt
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
function prompt { | |
$path = (Get-Location).Path | |
if ($path.Length -gt 45) | |
{ | |
$path = Get-Prompt($path); | |
} | |
"$path>" | |
} | |
function Get-Prompt([string] $path) | |
{ | |
$loc = ""; | |
$tokens = $path.Split('\'); | |
for ($i = 0; $i -lt $tokens.Count -1; $i++) | |
{ | |
$loc += $tokens[$i][0] + '\'; | |
} | |
$loc += $tokens[$tokens.count -1] | |
return $loc.ToUpper(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment