Simple PowerShell module to bookmark path locations in the shell.
Set-Bookmark [name]
will create a bookmark at the current or specified location. (Alias: "sb")Get-Bookmark
will return all saved bookmarks. (Alias: "gb")Use-Bookmark [name]
willSet-Location
to the current value of the bookmark. (Alias: "ub" and "go")Clear-Bookmark [name]
will remove the bookmark entry for the specified name or current location (Alias: "cb")
- Bookmarks are saved to a file at
Join-Path $env:userprofile "PoshBookmarks.json"
If you override your prompt
function (see PowerShell prompts) or otherwise include the following in your existing prompt
, you will see an indicator when the current location is a bookmarked entry:
function prompt {
$result = ""
$location = (Get-Location)
$locationString = $location.ToString()
if ($locationString.Length -gt 64) {
$result += $locationString += "`r`n"
$result += "PS"
} else {
$result += "PS $locationString"
}
$bookmarkKey = (Get-BookmarkKeys)[$location.Path]
if ($bookmarkKey -ne $null) {
$result += " [$bookmarkKey]"
}
"$result>"
}```