Scott Hanselman

Jump-Location - A Change Directory (CD) PowerShell Command that reads your mind

September 18, '14 Comments [25] Posted in Tools
Sponsored By

There's a lovely little utility called autojump for *nix consoles that makes the 'cd' command very smart. More that just auto-completion, it's a kind of "auto guessing." Hence, autojump. There is some beginning Windows support, but instead I turned to Tim Kellogg's open source PowerShell implementation "Jump-Location."

What a joy.

j this and j that

First, I was like "jump-location?" I'm not going to type that. But then, of course, duh. Aliases.

Jump-Location is aliased to just j, which means I can now do awesome stuff like this:

c:\> j sc
c:\users\scott> j g
c:\users\AppData\Local\GitHub> j des
c:\users\scott\Desktop>

But there's more. It's actually watching how long you are in a directory and keeping stats. You can see the weighted stats with "jumpstat" and the "database" is just a text file in ~\jump-location.txt.

If "j d" isn't enough to get me into C:\GitHub\DisProject then I can do "j g d" and I'm there. It's amazing.

Installation is easy, and I hope it gets on PsGet soon for even easier installation. Just unzip, unblock, ensure that your PowerShell execution policy allows scripts, and run ./install.ps1.

NOTE: Don't run install from your desktop, or a temp folder. Put the Jump-Location folder somewhere where it will live, and it's going to add a line like this to your user profile ("C:\Users\YOU\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1")  like this, so you'll want to install from a final path:

Import-Module 'C:\Users\Scott\Dropbox\utils\Jump-Location-0.5.1\Jump.Location.psd1'

I'm excited about this great little utility. Head over to https://github.com/tkellogg/Jump-Location and STAR it in GitHub, and give it a go! Tim, the author, is on Twitter at @kellogh. Other contributors include Sergey Vorobyev.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Thursday, 18 September 2014 21:01:38 UTC
Didn't know about PsGet, will install first thing tomorrow. So far I've used a homemade script backed by a file containing aliases to directories and alias autocompletion, but that jump thing looks more maintenance-free.
Frank Quednau
Thursday, 18 September 2014 23:21:06 UTC
Very disappointing.
It appears that the .zip doesn't contain the necessary .dlls.
Trying to build the project in VisStudio 2013 is equally problematic -- necessary nuget packages aren't updated, and even when they are, the project doesn't build.
Like I say, very disappointing.
CB
Thursday, 18 September 2014 23:28:31 UTC
CB - I just downloaded https://sourceforge.net/projects/jumplocation/files/latest/download and the DLLs are in there.
Scott Hanselman
Friday, 19 September 2014 00:16:49 UTC
I'm getting the error that the DLL can't be loaded as well, though it is there.

Import-Module : Could not load file or assembly 'file:///C:\users\[someguywhoreadshansleman]\OneDrive\Powershell\JumpLocation\Jump.Location.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515)
At C:\users\[someguywhoreadshansleman]\OneDrive\Powershell\JumpLocation\Load.ps1:14 char:2
+ Import-Module $dllpath -Global -DisableNameChecking
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand
Friday, 19 September 2014 00:21:10 UTC
Oh well, not Scott's job to debug. Off to Github.
Friday, 19 September 2014 01:03:20 UTC
I personally use Go, available on PsGet. It's not really the same thing, but it's about as useful and more predictable.

Basically it's bookmarking for directories. So I'll type 'go db' to go to c:\projects\database or 'go de' for c:\users\[username]\desktop etc. I had to set up these 'bookmarks' manually but I only have maybe half a dozen and they rarely change.
Friday, 19 September 2014 02:14:21 UTC
Just added a Chocolatey package for it - https://chocolatey.org/packages/Jump-Location
Lee Harold
Friday, 19 September 2014 04:10:16 UTC
MR - this implies that you either didn't unblock the zip, or that PS execution policy is off.
Scott Hanselman
Friday, 19 September 2014 04:47:52 UTC
Hmm I remember using using similar a while ago, it was called Z, it has a PsGet package.

https://github.com/vincpa/z

Has anybody used Z before, how does it compares to AutoJump?
Francicso Noriega
Friday, 19 September 2014 09:34:51 UTC
I suggest the alias "jlo", for getting a beautiful association each time you cd :)
Kenneth
Friday, 19 September 2014 12:33:22 UTC
The chocolatey install worked perfectly -- thanks Lee Harold!
CB
Friday, 19 September 2014 13:25:06 UTC
After running into some issues trying to install manually, I ran Lee Harold's chocolatey install and it was flawless. Thanks for that!
Friday, 19 September 2014 14:00:51 UTC
This is great! Thanks for sharing it. And thanks Lee for making the chocolatey install.
Rob
Friday, 19 September 2014 16:42:13 UTC
Nice job, Lee!
Scott Hanselman
Friday, 19 September 2014 19:22:49 UTC
Lee, nice job with the Chocolatey package! Would you mind submitting a github issue or pull request to help automate the deployment to Chocolatey?
Friday, 19 September 2014 20:21:55 UTC
Nice writeup Scott, and great little package Tim! I had been using poshmarks (Powershell port of bashmarks), but Jump-Location just supplanted that in less than a full day of use.
AJ Kerrigan
Sunday, 21 September 2014 05:48:58 UTC
Thanks for the tip - Jump-Location is very useful for me. I ran 'cinst jump-location' and everything worked. 'j' also has tab expansion among matches!
Ole Lynge
Monday, 22 September 2014 14:12:11 UTC
It's funny no one commented about Norton Change Directory. NCD was a nice little tool that was part of the Norton Utilities 4 (for DOS), back in 1987.
I think it was the father of all these little tools that make navigating through tons of folders a breeze.
Also, I think WCD (Wherever Change Directory) runs on both Windows and *nix machines.
Henrique Miranda
Tuesday, 23 September 2014 15:52:54 UTC
It also blows up posh-git autocompletion (which is awesome and magical and is all rainbows and unicorns), so it's out of my system, for now.

I'd rather use Windows Explorer and use the "ConEmu Here" right-click integration.

Note that the Chocolatey package doesn't uninstall properly and leaves the entry it created in the PS profile.
Wednesday, 24 September 2014 06:08:44 UTC
Thanks for share
Thursday, 25 September 2014 09:54:12 UTC
Thomas, I had the same problem with posh-git. Tried a couple of things that didn't work, what did work in the end was changing the load order to ensure posh-git loads after jump-location.

Just go to My Documents -> WindowsPowerShell and edit the "Microsoft.PowerShell_profile.ps1" file in a text editor.

I just moved the jump-location lines to the top and restarted powershell. Hopefully that works for you too.
Erno
Friday, 26 September 2014 10:15:04 UTC
We use our project fully based on T4Scaffolding Template. So we have to automate this T4scaffolding template. So tried to execute powershell command but scaffolding commands not working. just like

"The term 'scaffold' is not recognized as the name of a cmdlet, function, script file, or operable program"

Our requirement is to automate T4scaffolding and generated files move to another shared folder using junkin.

Please reply ASAP.

Thanks, JIVESH
Sunday, 28 September 2014 06:40:05 UTC
Thanks Tim, Scott and Lee. Mind-reading and mind-altering stuff. That is the most impressive scripting command I've ever seen, it is most inspiring.
John
Monday, 29 September 2014 05:04:42 UTC
Are people using powershell rather than cmd.exe by default now? Any reason to still use cmd.exe?
Jon
Tuesday, 18 November 2014 19:00:28 UTC
I really like jump-location, quite handy.

I did find a bug in it. It doesn't properly handle folders with parenthesis in the name. It'll add it to the database but will throw an error when you try to use jump-location to navigate there.

Maybe some day I'll find the time to fork the source and fix that but not this day.
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.