This module "replaces" the default cd
command (Set-Location
) in PowerShell. It provides:
- backwards and forwards navigation
- ability to list recent locations and to select one to navigate to.
You will need PowerShellGet. It is included in Windows 10 and WMF5. If you are using PowerShell V3 or V4, you will need to install PowerShellGet.
After installing PowerShellGet, you can simply run Install-Module PSLocationHistory
.
You can download the PSLocationHistory
folder from this repository and copy it to one of your modules directory, using this Microsoft guide to Installing a PowerShell Module.
You have to run some commands, which you can put in your profile, that will enable the history features of this module.
First, import the module. (This step may not be necessary as PowerShell now has $PSModuleAutoLoadingPreference
set to $true
by default)
Import-Module PSLocationHistory
Now enable the history features of the module:
Enable-LocationHistory
To go back to the previous directory, use the -b
or -Back
switch:
cd -b
After going backwards, you can then go forwards. Use the -f
or -Forward
switch:
cd -f
After using PowerShell for some time, you will want to go a directory that you visited earlier in the same session. To go so, use the -rl
or -RecentLocation
switch:
cd -rl
You will be presented with a list of options. You enter the number of the path you wish to go to, and then press <Enter>
. If there are more options, you can press <Enter>
(without a number), to view them. If you wish to cancel, press ctrl+c
.
This project is under the MIT licence.