Bashmarks, but for CMD.EXE

Tag: REFERENCE
Edit

Jumping between projects in CMD.EXE

So, as documented here, I often find myself at a shell, wanting to bounce around without having to CD all over the place.

Turns out that doing that in CMD.exe is both easier, and harder than doing it in bash. Easier because I didn't end up busting out regular expressions and self-modifying scripts, harder because I ended up writing a seperate program for handling the jumplist database, so that I could avoid doing that part of the file management in batch files, because I wasn't about to learn that much batch.

To get set up, build this go program using the standard Go toolchain (I won't explain that in detail here), and install the resulting executable in your %PATH%.

Once you have that program (or an equivalent) installed on your path, you'll want to add create the following batch files on your path as well.

This will allow you to type things into CMD.exe like "jadd MyProject", and then, from another directory, type "j MyProject" to get back to the folder you marked.

Usage:

jadd %MarkName%

Adds a mark to be able to jump to the current location

jl

Lists out all the existing marks by name, and what directories they point to

jrm %MarkName%

Removes the mark for the given mark name from the list of marks

j %MarkName$

Jumps via CD to the directory for the given mark. The main use for this tool


jadd.bat

@echo off
jumplist -add %1
juplist -ls

jl.bat

@echo off
jumplist -ls

jrm.bat

@echo off
jumplist -rm %1

j.bat

@echo off

jumplist.exe %1 > .jmpfile
SET /P CD_TARGET=<.jmpfile
del .jmpfile
CD "%CD_TARGET%"
SET CD_TARGET=