Monday, February 6, 2012
Mapped Drive Aware Prompt
function Prompt {
# if current Drive is a mapped drive, show the mount point
# If you add a mapping it will not show unless you:
# $Global:Drives = $null
if ($Global:Drives -eq $null) {
$Global:Drives = @{ }; Get-WmiObject Win32_LogicalDisk | %{ $Drives.Add($_.DeviceID,$_)};
}
$Loc = $(Get-Location)
$LocExtended = $Drives[$Loc.path.substring(0,2)].ProviderName + ' ' + $Loc
$(if (test-path variable:/PSDebugContext) { '[DBG]: ' } else { '' }) + 'PS ' + $LocExtended + $(if ($nestedpromptlevel -ge 1) { '>>' }) + '> '
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment